Works perfectly fine for me. Note that if you are submitting the commands in a single batch, then the abort action of INSERT OR ABORT aborts the batch. Submitting individual statements works just fine. You are submitting the script as a single sql statement rather than multiple statements (ie, save the script into a file with one command per line and it will work just peachy ...
2015-03-18 18:13:30 [D:\Temp] >sqlite < abort1.sql Error: near line 2: no such table: foo create table foo( value text, constraint uk unique( value ) ); begin transaction; insert into foo( value ) values( 'bar' ); commit; begin transaction; insert into foo( value ) values( 'bar' ); Error: near line 8: UNIQUE constraint failed: foo.value commit; begin transaction; insert into foo( value ) values( 'baz' ); commit; begin transaction; insert into foo( value ) values( 'baz' ); Error: near line 14: UNIQUE constraint failed: foo.value commit; 2015-03-18 18:13:53 [D:\Temp] >sqlite < abort2.sql Error: near line 2: no such table: foo create table foo( value text, constraint uk unique( value ) ); begin transaction; insert into foo( value ) values( 'bar' ); commit; begin transaction; insert into foo( value ) values( 'bar' ); Error: near line 5: UNIQUE constraint failed: foo.value begin transaction; Error: near line 6: cannot start a transaction within a transaction begin transaction; Error: near line 7: cannot start a transaction within a transaction --- Theory is when you know everything but nothing works. Practice is when everything works but no one knows why. Sometimes theory and practice are combined: nothing works and no one knows why. >-----Original Message----- >From: sqlite-users-bounces at mailinglists.sqlite.org [mailto:sqlite-users- >bounces at mailinglists.sqlite.org] On Behalf Of Petite Abeille >Sent: Wednesday, 18 March, 2015 15:02 >To: General Discussion of SQLite Database >Subject: Re: [sqlite] bug in transactions implementation ? > > >> On Mar 18, 2015, at 9:45 PM, Jason Vas Dias <jason.vas.dias at gmail.com> >wrote: >> >> Would you care to expand on that ? > >As it says on the tin [1]: you cannot start a transactions inside another >transaction (use savepoint if you want that), so? > >create table foo( value text, constraint uk unique( value ) ); >begin transaction; insert into foo( value ) values( 'bar' ); commit; ? ok >begin transaction; insert into foo( value ) values( 'bar' ); commit; ? >Error: UNIQUE constraint failed: foo.value >begin transaction; insert into foo( value ) values( 'baz' ); commit; ? >Error: cannot start a transaction within a transaction >rollback; ? ok >begin transaction; insert into foo( value ) values( 'baz' ); commit; ? ok > > >[1] https://www.sqlite.org/lang_transaction.html > > >_______________________________________________ >sqlite-users mailing list >sqlite-users at mailinglists.sqlite.org >http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users