diff --git a/manifest b/manifest index 4ae4cffcf7..378e652632 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Put\sin\sPRAGMA\sSANITY_CHECK\sin\splace\sof\sVACUUM.\s(CVS\s365) -D 2002-02-03T17:37:36 +C Fix\sa\sserious\sbug\sin\sINSERT\swhen\sthe\ssource\sis\sa\sSELECT.\s(CVS\s366) +D 2002-02-03T19:06:03 F Makefile.in 9fa4277413bf1d9cf91365f07d4108d7d87ed2af F Makefile.template 3372d45f8853afdb70bd30cc6fb50a3cd9069834 F README a4c0ba11354ef6ba0776b400d057c59da47a4cc0 @@ -19,14 +19,14 @@ F ltmain.sh e9ed72eb1d690f447c13945eaf69e28af531eda1 F publish.sh 5b59f4aff037aafa0e4a3b6fa599495dbd73f360 F sqlite.1 2e2bb0529ef468ade9e4322bd609d0695fb9ded9 F src/TODO af7f3cab0228e34149cf98e073aa83d45878e7e6 -F src/btree.c cbe62fae68290ae5b5e1015f6a0696479244bc5b +F src/btree.c 9d7a185510113c7d3a6e7ee9d4912f89838533a6 F src/btree.h 53476ad4f76537591dceded79fa484a2dc168888 F src/build.c 29504057ac5e2f40c08f19cb1574bd0512353169 F src/delete.c f8ad71be53cf18656b6573de65395852fe817f0c F src/expr.c a2a87dbd411a508ff89dffa90505ad42dac2f920 F src/hash.c 8f7c740ef2eaaa8decfa8751f2be30680b123e46 F src/hash.h d1ce47900c7325af5e41c4feb4855c4bf2b841e7 -F src/insert.c 173da7b06fe9282e0f529ff1e599460304ceeb23 +F src/insert.c 98edfd1ae7da7558cbaad3ae5023e1ea271513a6 F src/main.c 300320ba68d3e5b22c2c5b2c07fa884878202181 F src/md5.c 52f677bfc590e09f71d07d7e327bd59da738d07c F src/os.c 1953080d14098cd45e5bde88941567688efb72b1 @@ -36,7 +36,7 @@ F src/pager.h b28f004e2f5541dc60cc32db01bf80cf4d056283 F src/parse.y 734ba1e0dce9882345e65de5a14d9fe02fb757c2 F src/printf.c 300a90554345751f26e1fc0c0333b90a66110a1d F src/random.c f6b36bec5ebd3edb3440224bf5bf811fe4ac9a1b -F src/select.c fc11d5a8c2bae1b62d8028ffb111c773ad6bf161 +F src/select.c b32d3f38616f93f092b98c1c3e53c4dfe57dc359 F src/shell.c c102dfe388c7618a668c944ff157c49cb48f28e3 F src/shell.tcl 27ecbd63dd88396ad16d81ab44f73e6c0ea9d20e F src/sqlite.h.in f57074c84a2c112a5093ba7a9d9636aa9cacc87c @@ -49,7 +49,7 @@ F src/test3.c d6775f95fd91f5b3cf0e2382a28e5aaeb68f745b F src/tokenize.c 01a09db6adf933e941db1b781789a0c175be6504 F src/update.c 95459f94a061860bf8e5716b3426a5ba85c79103 F src/util.c 8f8973dd55a6ec63be9632fc5de86965c99d6327 -F src/vdbe.c 6e9851f14edaa98fd244103ff899082063a0e519 +F src/vdbe.c 94704a5733db95b78cc902208c5e8e26a784e7f8 F src/vdbe.h 3d49d22ba9ad14ea0e380bc582ff57347eaddb59 F src/where.c 2dda39367f193194e4c7d2e0dcab31527d9d8aba F test/all.test 2a51e5395ac7c2c539689b123b9782a05e3837fe @@ -57,15 +57,15 @@ F test/bigrow.test 8ab252dba108f12ad64e337b0f2ff31a807ac578 F test/btree.test 6ab4dc5f595905a276ef588fad3c9236dc07a47b F test/btree2.test 08e9485619265cbaf5d11bd71f357cdc26bb87e0 F test/btree3.test 9caa9e22491dd8cd8aa36d7ac3b48b089817c895 -F test/conflict.test 5515d5dcbb6be9c715d1b83b2796b8a9cb7a32d4 -F test/copy.test 9ff0063c0b95b3d51b8d0c7fe0ff51dabaa66549 +F test/conflict.test 7c7dbfdfaee24453237eff3570a93dab56cb755a +F test/copy.test 6691f7f671a0521361b27c4ef6e5d340604d3b5c F test/delete.test c904a62129fe102b314a96111a8417f10249e4d8 F test/expr.test c8a495050dcec3f9e68538c3ef466726933302c1 F test/func.test 51dbe3f8a4c28972751697423e6acc5d6b551df1 F test/in.test c09312672e3f0709fa02c8e2e9cd8fb4bd6269aa F test/index.test c8a471243bbf878974b99baf5badd59407237cf3 -F test/insert.test a5c122aa726f1cef6f07d6767e8fd6f220994c11 -F test/insert2.test d6901ca931e308fea7fca8c95ebe7dc957cc9fc2 +F test/insert.test 5e75827fc255cff240c30f11ccb635067dfc70ce +F test/insert2.test 3fd6547056114bbb2da1d8cd7778affda4a30a12 F test/intpkey.test ce3de8326082929667cf356855426519cfe2f5c7 F test/ioerr.test 57d9bffaca18b34f9e976f786eadc2591d6efc6a F test/limit.test a930f3eba2a7691c8397ccab33710b931589566a @@ -107,22 +107,22 @@ F www/arch.fig d5f9752a4dbf242e9cfffffd3f5762b6c63b3bcf F www/arch.png 82ef36db1143828a7abc88b1e308a5f55d4336f4 F www/arch.tcl 72a0c80e9054cc7025a50928d28d9c75c02c2b8b F www/c_interface.tcl 82a026b1681757f13b3f62e035f3a31407c1d353 -F www/changes.tcl 5c3b5b80d7144d46f100f333d4cab6184828a6c2 +F www/changes.tcl 445dd536ade7085f4ffe820805847451d01c87bb F www/conflict.tcl 81dd21f9a679e60aae049e9dd8ab53d59570cda2 F www/crosscompile.tcl 3622ebbe518927a3854a12de51344673eb2dd060 F www/download.tcl a6d75b8b117cd33dcb090bef7e80d7556d28ebe0 F www/dynload.tcl 02eb8273aa78cfa9070dd4501dca937fb22b466c F www/faq.tcl 32cbc134879871604070d4cc3a32e73fb22a35f9 F www/formatchng.tcl 2d9a35c787823b48d72a5c64bb5414a43e26d5ad -F www/index.tcl 748614d8208c761ed3840e7958b8eed04de81822 -F www/lang.tcl 260f3f9015344634ed9c2518f9a856462d37d6a6 +F www/index.tcl fba075f31a9cbbf13e6adec080e4943db54dbc05 +F www/lang.tcl 58077cb0c383fb312c04bf2ab6a80d7b1c525987 F www/mingw.tcl f1c7c0a7f53387dd9bb4f8c7e8571b7561510ebc F www/opcode.tcl bdec8ef9f100dbd87bbef8976c54b88e43fd8ccc F www/speed.tcl 83457b2bf6bb430900bd48ca3dd98264d9a916a5 F www/sqlite.tcl 8b5884354cb615049aed83039f8dfe1552a44279 F www/tclsqlite.tcl 829b393d1ab187fd7a5e978631b3429318885c49 F www/vdbe.tcl 2013852c27a02a091d39a766bc87cff329f21218 -P 95d1f8389dd5e168bdf0290169662296b6a0f6d9 -R 1674dac486d8e0c1072b57bc5cd4e3c0 +P 7c65029e5bf26eb640aef529a7421cd0d6ffd1a9 +R 4e3b7ab35202d05c1b0326ce879539fa U drh -Z 536d009bb8b29d6b3df6118f3f597eb5 +Z 666cc540a7569a442b5d9d36de8269cd diff --git a/manifest.uuid b/manifest.uuid index c741447554..d72f712a95 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -7c65029e5bf26eb640aef529a7421cd0d6ffd1a9 \ No newline at end of file +20ea737536700b016385c70105a2af8b2bffce2b \ No newline at end of file diff --git a/src/btree.c b/src/btree.c index 5e8439cb36..49616ec7d1 100644 --- a/src/btree.c +++ b/src/btree.c @@ -9,7 +9,7 @@ ** May you share freely, never taking more than you give. ** ************************************************************************* -** $Id: btree.c,v 1.50 2002/02/03 17:37:36 drh Exp $ +** $Id: btree.c,v 1.51 2002/02/03 19:06:03 drh Exp $ ** ** This file implements a external (disk-based) database using BTrees. ** For a detailed discussion of BTrees, refer to @@ -2461,7 +2461,7 @@ int sqliteBtreeUpdateMeta(Btree *pBt, int *aMeta){ ** All of the following code is omitted if the library is compiled with ** the -DNDEBUG=1 compiler option. ******************************************************************************/ -#ifndef NDEEBUG +#ifndef NDEBUG /* ** Print a disassembly of the given page on standard output. This routine diff --git a/src/insert.c b/src/insert.c index e387150da3..f993b89ea9 100644 --- a/src/insert.c +++ b/src/insert.c @@ -12,7 +12,7 @@ ** This file contains C code routines that are called by the parser ** to handle INSERT statements in SQLite. ** -** $Id: insert.c,v 1.41 2002/02/03 00:56:10 drh Exp $ +** $Id: insert.c,v 1.42 2002/02/03 19:06:03 drh Exp $ */ #include "sqliteInt.h" @@ -238,7 +238,7 @@ void sqliteInsert( sqliteVdbeAddOp(v, OP_String, 0, 0); sqliteVdbeChangeP3(v, -1, pTab->aCol[i].zDflt, P3_STATIC); }else if( srcTab>=0 ){ - sqliteVdbeAddOp(v, OP_Column, srcTab, i); + sqliteVdbeAddOp(v, OP_Column, srcTab, j); }else{ sqliteExprCode(pParse, pList->a[j].pExpr); } diff --git a/src/select.c b/src/select.c index b0ef7081fe..b2cf364f6f 100644 --- a/src/select.c +++ b/src/select.c @@ -12,7 +12,7 @@ ** This file contains C code routines that are called by the parser ** to handle SELECT statements in SQLite. ** -** $Id: select.c,v 1.56 2002/01/28 15:53:05 drh Exp $ +** $Id: select.c,v 1.57 2002/02/03 19:06:03 drh Exp $ */ #include "sqliteInt.h" @@ -335,7 +335,7 @@ static int fillInColumnList(Parse *pParse, Select *p){ if( pTabList->a[i].zName==0 ){ /* No table name is given. Instead, there is a (SELECT ...) statement ** the results of which should be used in place of the table. The - ** was this is implemented is that the (SELECT ...) writes its results + ** way this is implemented is that the (SELECT ...) writes its results ** into a temporary table which is then scanned like any other table. */ sqliteSetString(&pParse->zErrMsg, diff --git a/src/vdbe.c b/src/vdbe.c index b663b315d3..aa2273d8b1 100644 --- a/src/vdbe.c +++ b/src/vdbe.c @@ -30,7 +30,7 @@ ** But other routines are also provided to help in building up ** a program instruction by instruction. ** -** $Id: vdbe.c,v 1.116 2002/02/03 03:34:09 drh Exp $ +** $Id: vdbe.c,v 1.117 2002/02/03 19:06:03 drh Exp $ */ #include "sqliteInt.h" #include @@ -3493,7 +3493,7 @@ case OP_CreateTable: { ** This opcode is used for testing purposes only. */ case OP_SanityCheck: { -#if 1 /* This opcode used for testing only */ +#ifndef NDEBUG /* This opcode used for testing only */ int nRoot; int *aRoot; int tos = ++p->tos; @@ -3503,10 +3503,8 @@ case OP_SanityCheck: { HashElem *i; char *z; - if( iSet<0 || iSet>=p->nSet ){ - goto bad_instruction; - } - VERIFY( if( NeedStack(p, p->tos) ) goto no_mem; ) + if( iSet<0 || iSet>=p->nSet ) goto bad_instruction; + if( NeedStack(p, p->tos) ) goto no_mem; pSet = &p->aSet[iSet]; nRoot = sqliteHashCount(&pSet->hash); aRoot = sqliteMalloc( sizeof(int)*(nRoot+1) ); @@ -3525,7 +3523,8 @@ case OP_SanityCheck: { aStack[tos].n = strlen(z) + 1; aStack[tos].flags = STK_Str | STK_Dyn; } -#endif /* SQLITE_TEST */ + sqliteFree(aRoot); +#endif /* !define(NDEBUG) */ break; } diff --git a/test/conflict.test b/test/conflict.test index 7bf5efd6ee..be0033c771 100644 --- a/test/conflict.test +++ b/test/conflict.test @@ -13,7 +13,7 @@ # This file implements tests for the conflict resolution extension # to SQLite. # -# $Id: conflict.test,v 1.6 2002/02/03 03:34:09 drh Exp $ +# $Id: conflict.test,v 1.7 2002/02/03 19:06:03 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -377,5 +377,10 @@ foreach {i conf1 conf2 cmd t0 t1 t2} { } [list $t0 $t1 $t2] } +do_test insert-99.1 { + set x [execsql {PRAGMA sanity_check}] + if {$x==""} {set x ok} + set x +} {ok} finish_test diff --git a/test/copy.test b/test/copy.test index db0aa2b31d..95afb35d31 100644 --- a/test/copy.test +++ b/test/copy.test @@ -11,7 +11,7 @@ # This file implements regression tests for SQLite library. The # focus of this file is testing the COPY statement. # -# $Id: copy.test,v 1.8 2002/01/31 15:54:23 drh Exp $ +# $Id: copy.test,v 1.9 2002/02/03 19:06:03 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -207,6 +207,30 @@ do_test copy-5.4 { SELECT * FROM t1; } } {0 {22 33 11 33 22 44}} + +do_test copy-5.5 { + execsql { + DELETE FROM t1; + PRAGMA count_changes=on; + COPY t1 FROM 'data5.txt' USING DELIMITERS '|'; + } +} {2} +do_test copy-5.6 { + execsql { + COPY OR REPLACE t1 FROM 'data5.txt' USING DELIMITERS '|'; + } +} {2} +do_test copy-5.7 { + execsql { + COPY OR IGNORE t1 FROM 'data5.txt' USING DELIMITERS '|'; + } +} {0} + +do_test copy-6.0 { + set x [execsql {PRAGMA sanity_check}] + if {$x==""} {set x ok} + set x +} {ok} # Cleanup diff --git a/test/insert.test b/test/insert.test index 8754769076..3db1a44225 100644 --- a/test/insert.test +++ b/test/insert.test @@ -11,7 +11,7 @@ # This file implements regression tests for SQLite library. The # focus of this file is testing the INSERT statement. # -# $Id: insert.test,v 1.6 2001/09/16 00:13:28 drh Exp $ +# $Id: insert.test,v 1.7 2002/02/03 19:06:03 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -156,5 +156,11 @@ do_test insert-3.3 { do_test insert-3.4 { execsql {SELECT * FROM test2 WHERE f1=22 AND f2=-4.44} } {22 -4.44 hi abc-123 wham} +do_test insert-3.5 { + set x [execsql {PRAGMA sanity_check}] + if {$x==""} {set x ok} + set x +} {ok} + finish_test diff --git a/test/insert2.test b/test/insert2.test index 610e587511..51f95d5141 100644 --- a/test/insert2.test +++ b/test/insert2.test @@ -12,7 +12,7 @@ # focus of this file is testing the INSERT statement that takes is # result from a SELECT. # -# $Id: insert2.test,v 1.5 2001/10/15 00:44:36 drh Exp $ +# $Id: insert2.test,v 1.6 2002/02/03 19:06:03 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -83,4 +83,39 @@ do_test insert2-1.4 { lappend r [execsql {SELECT log FROM t1 WHERE cnt=4 ORDER BY log}] } {0 1 1 1 2 2 3 4 4 8 5 4 4 {3 5}} +do_test insert2-2.0 { + execsql { + CREATE TABLE t3(a,b,c); + CREATE TABLE t4(x,y); + INSERT INTO t4 VALUES(1,2); + SELECT * FROM t4; + } +} {1 2} +do_test insert2-2.1 { + execsql { + INSERT INTO t3(a,c) SELECT * FROM t4; + SELECT * FROM t3; + } +} {1 {} 2} +do_test insert2-2.2 { + execsql { + DELETE FROM t3; + INSERT INTO t3(c,b) SELECT * FROM t4; + SELECT * FROM t3; + } +} {{} 2 1} +do_test insert2-2.3 { + execsql { + DELETE FROM t3; + INSERT INTO t3(c,a,b) SELECT x, 'hi', y FROM t4; + SELECT * FROM t3; + } +} {hi 2 1} + +do_test insert2-4.0 { + set x [execsql {PRAGMA sanity_check}] + if {$x==""} {set x ok} + set x +} {ok} + finish_test diff --git a/www/changes.tcl b/www/changes.tcl index 148aa577a6..732fe6cc78 100644 --- a/www/changes.tcl +++ b/www/changes.tcl @@ -17,7 +17,10 @@ proc chng {date desc} { puts "

" } -chng {2002 Jan 30 (2.3.0 beta)} { +chng {2002 Jan 30 (2.3.0)} { +
  • Fix a serious bug in the INSERT command which was causing data to go + into the wrong columns if the data source was a SELECT and the INSERT + clauses specified its columns in some order other than the default.
  • Added the ability to resolve constraint conflicts is ways other than an abort and rollback. See the documentation on the "ON CONFLICT" clause for details.
  • @@ -28,6 +31,7 @@ chng {2002 Jan 30 (2.3.0 beta)} {
  • NOT NULL constraints are honored.
  • The COPY command puts NULLs in columns whose data is '\N'.
  • In the COPY command, backslash can now be used to escape a newline.
  • +
  • Added the SANITY_CHECK pragma.
  • } chng {2002 Jan 28 (2.2.5)} { diff --git a/www/index.tcl b/www/index.tcl index 3ae7a97b2b..10e78ba103 100644 --- a/www/index.tcl +++ b/www/index.tcl @@ -1,7 +1,7 @@ # # Run this TCL script to generate HTML for the index.html file. # -set rcsid {$Id: index.tcl,v 1.52 2002/01/29 18:41:26 drh Exp $} +set rcsid {$Id: index.tcl,v 1.53 2002/02/03 19:06:04 drh Exp $} puts { SQLite: An SQL Database Engine In A C Library @@ -64,8 +64,7 @@ puts {

    Current Status

    A change history is available online. The latest source code is available for download. -There are currently no known memory leaks or bugs -in version 2.2.5 of the library. +For a list of recently discovered bugs, refer to the change history.

    diff --git a/www/lang.tcl b/www/lang.tcl index 39ed433008..bfed8280c2 100644 --- a/www/lang.tcl +++ b/www/lang.tcl @@ -1,7 +1,7 @@ # # Run this Tcl script to generate the sqlite.html file. # -set rcsid {$Id: lang.tcl,v 1.21 2002/02/03 00:56:11 drh Exp $} +set rcsid {$Id: lang.tcl,v 1.22 2002/02/03 19:06:04 drh Exp $} puts { @@ -624,7 +624,7 @@ the command made prior to encountering the constraint violation are preserved and are not backed out. For example, if an UPDATE statement encountered a constraint violation on the 100th row that it attempts to update, then the first 99 row changes are preserved -by change to rows 100 and beyond never occur.

    +but changes to rows 100 and beyond never occur.

    IGNORE

    When a constraint violation occurs, the one row that contains @@ -637,7 +637,11 @@ normally. No error is returned.

    When a UNIQUE constraint violation occurs, the pre-existing row that is causing the constraint violation is removed prior to inserting or updating the current row. Thus the insert or update always occurs. -The command continues executing normally. No error is returned.

    +The command continues executing normally. No error is returned.

    +

    If a NOT NULL constraint violation occurs, the NULL value is replaced +by the default value for that column. If the column has no default +value, then the ABORT algorithm is used.

    +

    @@ -736,6 +740,15 @@ with caution.

    This only works if the library is compiled without the NDEBUG macro.

    +
  • PRAGMA sanity_check;

    +

    The command does an integrity check of the entire database. It + looks for out-of-order records, missing pages, and malformed records. + If any problems are found, then a single string is returned which is + a description of all problems. If everything is in order, "ok" is + returned. This command is used for testing and debugging only and + is not available if the library is compiled + with the -DNDEBUG=1 compiler option.

    +
  • PRAGMA table_info(table-name);

    For each column in the named table, invoke the callback function once with information about that column, including the column name,