From: drh Date: Tue, 14 Jun 2005 02:12:46 +0000 (+0000) Subject: Do not record existance the sqlite_sequence table until it is actually X-Git-Tag: version-3.6.10~3646 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=78776ecdb13fba8378af6e4cbdae52399d0775dd;p=thirdparty%2Fsqlite.git Do not record existance the sqlite_sequence table until it is actually created. Ticket #1283. (CVS 2513) FossilOrigin-Name: 95256d953c179372dcc5ead6c407672c8161a8c1 --- diff --git a/manifest b/manifest index 7f8f6896f9..c7e9ab39dd 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sdocumentation\stypo.\s\sTicket\s\s#1282.\s(CVS\s2512) -D 2005-06-13T00:48:00 +C Do\snot\srecord\sexistance\sthe\ssqlite_sequence\stable\suntil\sit\sis\sactually\ncreated.\s\sTicket\s#1283.\s(CVS\s2513) +D 2005-06-14T02:12:46 F Makefile.in 8129e7f261d405db783676f9ca31e0841768c652 F Makefile.linux-gcc 06be33b2a9ad4f005a5f42b22c4a19dab3cbb5c7 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028 @@ -32,7 +32,7 @@ F src/attach.c 3615dbe960cbee4aa5ea300b8a213dad36527b0f F src/auth.c 18c5a0befe20f3a58a41e3ddd78f372faeeefe1f F src/btree.c d2e09ebf755bfd665727133361b22c6a915b12d7 F src/btree.h 41a71ce027db9ddee72cb43df2316bbe3a1d92af -F src/build.c 593d8fda0576a72e6f1fbf8f1a61db110dde9264 +F src/build.c b6db069ef2e1e1b21460857f498d45a9c0080fe8 F src/callback.c 0910b611e0c158f107ee3ff86f8a371654971e2b F src/date.c 2134ef4388256e8247405178df8a61bd60dc180a F src/delete.c 4b68127f55971c7fb459146e0b6cf3bd70cfffe9 @@ -93,7 +93,7 @@ F test/attach.test f320e98bcca68d100cab7666a0c9a93ac5f236bd F test/attach2.test 3396c012a39ddf7ba6b528d80bd79554168aa115 F test/attach3.test 63013383adc4380af69779f34f4af19bd49f7cbe F test/auth.test 5129bfe268133092ad2928b8644ef97fa4602b2e -F test/autoinc.test bef47b3c1c1093599905d1d9c79140f265896db0 +F test/autoinc.test 2aba7dc87438d221e2f2ea0e3e7d5fb6812edf6d F test/autovacuum.test cf2719b17659f7a011202ad05905654cedf26023 F test/autovacuum_crash.test 05a63b8805b20cfba7ace82856ce4ccdda075a31 F test/autovacuum_ioerr.test 9cf27275ca47b72e188a47c53b61b6d583a01d24 @@ -281,7 +281,7 @@ F www/tclsqlite.tcl 425be741b8ae664f55cb1ef2371aab0a75109cf9 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b F www/whentouse.tcl 528299b8316726dbcc5548e9aa0648c8b1bd055b -P 0e190e9d9137e9d29fc53ce6f1136047d578bb55 -R 69a15ae8b132956d878be49b79f37737 +P ce6b62fa46bc67085801c48d6a28944d4d373ba9 +R 9d8a9caa3f6f6c80defde0cdf07c4d4f U drh -Z 92f8243036f5a7ffb94f41f03ecbe221 +Z 314129c4c40699681e64c32b930006f5 diff --git a/manifest.uuid b/manifest.uuid index 3014ab1a8a..ed45574a7b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ce6b62fa46bc67085801c48d6a28944d4d373ba9 \ No newline at end of file +95256d953c179372dcc5ead6c407672c8161a8c1 \ No newline at end of file diff --git a/src/build.c b/src/build.c index ae21902b0a..27f2adcf0d 100644 --- a/src/build.c +++ b/src/build.c @@ -22,7 +22,7 @@ ** COMMIT ** ROLLBACK ** -** $Id: build.c,v 1.326 2005/06/12 21:35:52 drh Exp $ +** $Id: build.c,v 1.327 2005/06/14 02:12:46 drh Exp $ */ #include "sqliteInt.h" #include @@ -745,7 +745,7 @@ void sqlite3StartTable( ** so that INSERT can find the table easily. */ #ifndef SQLITE_OMIT_AUTOINCREMENT - if( strcmp(zName, "sqlite_sequence")==0 ){ + if( !pParse->nested && strcmp(zName, "sqlite_sequence")==0 ){ db->aDb[iDb].pSeqTab = pTable; } #endif diff --git a/test/autoinc.test b/test/autoinc.test index e456a8e8cd..dcf32cede2 100644 --- a/test/autoinc.test +++ b/test/autoinc.test @@ -11,7 +11,7 @@ # This file implements regression tests for SQLite library. The # focus of this script is testing the AUTOINCREMENT features. # -# $Id: autoinc.test,v 1.5 2005/03/29 03:11:00 danielk1977 Exp $ +# $Id: autoinc.test,v 1.6 2005/06/14 02:12:46 drh Exp $ # set testdir [file dirname $argv0] @@ -504,5 +504,32 @@ do_test autoinc-7.2 { } } {1 {AUTOINCREMENT is only allowed on an INTEGER PRIMARY KEY}} -catch {db2 close} + +# Ticket #1283. Make sure that preparing but never running a statement +# that creates the sqlite_sequence table does not mess up the database. +# +do_test autoinc-8.1 { + catch {db2 close} + catch {db close} + file delete -force test.db + set DB [sqlite3 db test.db] + set STMT [sqlite3_prepare $DB { + CREATE TABLE t1( + x INTEGER PRIMARY KEY AUTOINCREMENT + ) + } -1 TAIL] + sqlite3_finalize $STMT + set STMT [sqlite3_prepare $DB { + CREATE TABLE t1( + x INTEGER PRIMARY KEY AUTOINCREMENT + ) + } -1 TAIL] + sqlite3_step $STMT + sqlite3_finalize $STMT + execsql { + INSERT INTO t1 VALUES(NULL); + SELECT * FROM t1; + } +} {1} + finish_test