>> 00:01 Transaction A: BEGIN
>> 00:02 Transaction B: BEGIN
>> 00:03 Transaction A: INSERT INTO test VALUES (1) // works okay
>> 00:04 Transaction B: INSERT INTO test VALUES (1) // aborts with 'duplicate 
>> key' error! why???
>
> I get SQLITE_BUSY "database is locked" at this point, as I would expect.

MySQL may behave differently but that's discussion not for this list.


Pavel


On Wed, May 11, 2011 at 11:41 AM, Igor Tandetnik <itandet...@mvps.org> wrote:
> On 5/11/2011 11:24 AM, Dagdamor wrote:
>> Hello. First of all, sorry for posting three completely different questions 
>> into the same message ;)
>>
>> Question #1. I was working with transactions in InnoDB (MySQL) and noticed a 
>> weird behavior. Consider we have a table:
>>
>> CREATE TABLE test (id INT NOT NULL PRIMARY KEY);
>>
>> and two transactions (from two different connections) are trying to insert a 
>> record at once:
>>
>> 00:01 Transaction A: BEGIN
>> 00:02 Transaction B: BEGIN
>> 00:03 Transaction A: INSERT INTO test VALUES (1) // works okay
>> 00:04 Transaction B: INSERT INTO test VALUES (1) // aborts with 'duplicate 
>> key' error! why???
>
> I get SQLITE_BUSY "database is locked" at this point, as I would expect.
> --
> Igor Tandetnik
>
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to