From: drh Date: Sun, 3 Jan 2016 18:07:57 +0000 (+0000) Subject: Bug fix: the conflict resolution behavior for the implied NOT NULL constraint X-Git-Tag: version-3.10.0~12 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=dc0b1f1c29e949a6145ed0e548846ba42b64d729;p=thirdparty%2Fsqlite.git Bug fix: the conflict resolution behavior for the implied NOT NULL constraint on the PRIMARY KEY of a WITHOUT ROWID table should be ABORT. FossilOrigin-Name: e30062e9f6cae980150dda7df440b36dfdcb7bbe --- diff --git a/manifest b/manifest index 218d499932..584914720e 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\spremature\sreference\sto\sutf8_printf\sin\sshell.c. -D 2016-01-03T11:27:47.410 +C Bug\sfix:\sthe\sconflict\sresolution\sbehavior\sfor\sthe\simplied\sNOT\sNULL\sconstraint\non\sthe\sPRIMARY\sKEY\sof\sa\sWITHOUT\sROWID\stable\sshould\sbe\sABORT. +D 2016-01-03T18:07:57.631 F Makefile.in 28bcd6149e050dff35d4dcfd97e890cd387a499d F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 5fff077fcc46de7714ed6eebb6159a4c00eab751 @@ -279,7 +279,7 @@ F src/btmutex.c 45a968cc85afed9b5e6cf55bf1f42f8d18107f79 F src/btree.c 4d3452b2a3daf875490ac4f0a278da7f85fabe12 F src/btree.h 2d76dee44704c47eed323356a758662724b674a0 F src/btreeInt.h b5f2651b41808f038dee9282c5dc0232ce6532d3 -F src/build.c 1c9fb552148ee8f9234435a38833f8fca2081a71 +F src/build.c d8006e9030c61b9495d0b2f724edd3fcdae16930 F src/callback.c 7b44ce59674338ad48b0e84e7b72f935ea4f68b0 F src/complete.c addcd8160b081131005d5bc2d34adf20c1c5c92f F src/ctime.c 60e135af364d777a9ab41c97e5e89cd224da6198 @@ -524,7 +524,7 @@ F test/collateA.test b8218ab90d1fa5c59dcf156efabb1b2599c580d6 F test/colmeta.test 2c765ea61ee37bc43bbe6d6047f89004e6508eb1 F test/colname.test 08948a4809d22817e0e5de89c7c0a8bd90cb551b F test/conflict.test 841bcf7cabbfca39c577eb8411ea8601843b46a8 -F test/conflict2.test 0d3af4fb534fa1bd020c79960bb56e4d52655f09 +F test/conflict2.test 0f0e810aef6739650d7f442164975e932cf18afc F test/conflict3.test dec0634c0f31dec9a4b01c63063e939f0cd21b6b F test/contrib01.test 2a1cbc0f2f48955d7d073f725765da6fbceda6b4 F test/corrupt.test 141c39ea650c1365e85a49e402fa05cb9617fb97 @@ -1340,7 +1340,7 @@ F test/without_rowid1.test 1a7b9bd51b899928d327052df9741d2fe8dbe701 F test/without_rowid2.test af260339f79d13cb220288b67cd287fbcf81ad99 F test/without_rowid3.test aad4f9d383e199349b6c7e508a778f7dff5dff79 F test/without_rowid4.test 4e08bcbaee0399f35d58b5581881e7a6243d458a -F test/without_rowid5.test 61256715b686359df48ca1742db50cc7e3e7b862 +F test/without_rowid5.test 89b1c587bd92a0590e440da33e7666bf4891572a F test/without_rowid6.test 1f99644e6508447fb050f73697350c7ceca3392e F test/wordcount.c 2a0a6c0d0e8e8bbbac1f06d72a6791828c37c0cf F test/zeroblob.test 3857870fe681b8185654414a9bccfde80b62a0fa @@ -1406,7 +1406,7 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P cd3ae0f14c6b28b328b208431d0effcb7b062ec6 -R 17c9e71fcd959bf7c676bff4a8176b10 +P 76f5efa68728d899a63a74f2528dfd0c497aa5f0 +R 478df71a9631f4b73fcefbae5de2f355 U drh -Z cf0da92d1077e771f4727b72b37c0046 +Z 2ce3cb02ff6782c368c437352328d0d1 diff --git a/manifest.uuid b/manifest.uuid index 1130aa9c0e..c0ad5b411d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -76f5efa68728d899a63a74f2528dfd0c497aa5f0 \ No newline at end of file +e30062e9f6cae980150dda7df440b36dfdcb7bbe \ No newline at end of file diff --git a/src/build.c b/src/build.c index ffefead9db..63e3004657 100644 --- a/src/build.c +++ b/src/build.c @@ -1774,7 +1774,7 @@ static void convertToWithoutRowidTable(Parse *pParse, Table *pTab){ ** do not enforce this for imposter tables.) */ if( !db->init.imposterTable ){ for(i=0; iaCol[pPk->aiColumn[i]].notNull = 1; + pTab->aCol[pPk->aiColumn[i]].notNull = OE_Abort; } pPk->uniqNotNull = 1; } diff --git a/test/conflict2.test b/test/conflict2.test index 8419f1a3ff..e8880635f1 100644 --- a/test/conflict2.test +++ b/test/conflict2.test @@ -289,11 +289,11 @@ do_test conflict2-6.0 { # foreach {i conf1 cmd t0 t1 t2 t3 t4} { 1 {} UPDATE 1 {6 7 8 9} 1 0 1 - 2 REPLACE UPDATE 0 {7 6 9} 1 0 0 - 3 IGNORE UPDATE 0 {6 7 3 9} 1 0 0 - 4 FAIL UPDATE 1 {6 7 3 4} 1 0 0 + 2 REPLACE UPDATE 0 {7 6 9} 1 1 0 + 3 IGNORE UPDATE 0 {6 7 3 9} 1 1 0 + 4 FAIL UPDATE 1 {6 7 3 4} 1 1 0 5 ABORT UPDATE 1 {1 2 3 4} 1 0 1 - 6 ROLLBACK UPDATE 1 {1 2 3 4} 0 0 0 + 6 ROLLBACK UPDATE 1 {1 2 3 4} 0 1 0 7 REPLACE {UPDATE OR IGNORE} 0 {6 7 3 9} 1 0 0 8 IGNORE {UPDATE OR REPLACE} 0 {7 6 9} 1 0 1 9 FAIL {UPDATE OR IGNORE} 0 {6 7 3 9} 1 0 0 diff --git a/test/without_rowid5.test b/test/without_rowid5.test index d163d9c1bc..31a440ad87 100644 --- a/test/without_rowid5.test +++ b/test/without_rowid5.test @@ -132,9 +132,13 @@ do_execsql_test without_rowid5-5.1 { INSERT INTO ipk VALUES('rival','bonus'); -- ok to insert non-integer key SELECT * FROM ipk; } {rival bonus} -do_catchsql_test without_rowid5-5.2 { +do_catchsql_test without_rowid5-5.2a { + BEGIN; INSERT INTO ipk VALUES(NULL,'sample'); -- no automatic generation of keys } {1 {NOT NULL constraint failed: ipk.key}} +do_execsql_test without_rowid5-5.2b { + ROLLBACK; +} {} # EVIDENCE-OF: R-33142-02092 AUTOINCREMENT does not work on WITHOUT # ROWID tables.