Fix an assertion failure that occurs when attempting to delete all rows of

a table while the "count_changes" pragma is turned on.  Up the version number
to 2.6.1. (CVS 690)

FossilOrigin-Name: 612df004017b241651074ee859096dd0ee5062b8
This commit is contained in:
drh 2002-07-19 18:52:40 +00:00
parent 426cc56a6b
commit 26b3e1bc06
8 changed files with 91 additions and 25 deletions

View File

@ -1 +1 @@
2.6.0 2.6.1

View File

@ -1,9 +1,9 @@
C Add\sstatic\sident\sstrings\s(such\sas\spicked\sup\sby\sthe\sRCS\s"ident"\scommand)\ncontaining\sthe\slibrary\sversion\snumber.\s(CVS\s689) C Fix\san\sassertion\sfailure\sthat\soccurs\swhen\sattempting\sto\sdelete\sall\srows\sof\na\stable\swhile\sthe\s"count_changes"\spragma\sis\sturned\son.\s\sUp\sthe\sversion\snumber\nto\s2.6.1.\s(CVS\s690)
D 2002-07-19T18:13:36 D 2002-07-19T18:52:41
F Makefile.in 6291a33b87d2a395aafd7646ee1ed562c6f2c28c F Makefile.in 6291a33b87d2a395aafd7646ee1ed562c6f2c28c
F Makefile.template 4e11752e0b5c7a043ca50af4296ec562857ba495 F Makefile.template 4e11752e0b5c7a043ca50af4296ec562857ba495
F README a4c0ba11354ef6ba0776b400d057c59da47a4cc0 F README a4c0ba11354ef6ba0776b400d057c59da47a4cc0
F VERSION b36b90fdfe67f5f38d70b444e4430701df184330 F VERSION 162ea0af81011c17ff003197a34f3b1d5318a7f2
F aclocal.m4 11faa843caa38fd451bc6aeb43e248d1723a269d F aclocal.m4 11faa843caa38fd451bc6aeb43e248d1723a269d
F config.guess f38b1e93d1e0fa6f5a6913e9e7b12774b9232588 F config.guess f38b1e93d1e0fa6f5a6913e9e7b12774b9232588
F config.sub f14b07d544ca26b5d698259045136b783e18fc7f F config.sub f14b07d544ca26b5d698259045136b783e18fc7f
@ -21,14 +21,14 @@ F src/TODO af7f3cab0228e34149cf98e073aa83d45878e7e6
F src/btree.c f014b682e184876aba5df14a68f96594e0b7ae00 F src/btree.c f014b682e184876aba5df14a68f96594e0b7ae00
F src/btree.h 8abeabfe6e0b1a990b64fa457592a6482f6674f3 F src/btree.h 8abeabfe6e0b1a990b64fa457592a6482f6674f3
F src/build.c 2f81c837284840448f21c90ef7c9c6c6c0d4d8a0 F src/build.c 2f81c837284840448f21c90ef7c9c6c6c0d4d8a0
F src/delete.c bc35d6aa7e7b2a4f88510a17e060abb355a53bd6 F src/delete.c c9f59ee217e062eb9de7b64b76b5cfff42b2f028
F src/encode.c 346b12b46148506c32038524b95c4631ab46d760 F src/encode.c 346b12b46148506c32038524b95c4631ab46d760
F src/expr.c 8a6b669ba5d6cd2810e8671f918ddb0fac3dd1b1 F src/expr.c 8a6b669ba5d6cd2810e8671f918ddb0fac3dd1b1
F src/func.c e45cd908b9b723d9b91473d09e12c23f786b3fc2 F src/func.c e45cd908b9b723d9b91473d09e12c23f786b3fc2
F src/hash.c 6a6236b89c8c060c65dabd300a1c8ce7c10edb72 F src/hash.c 6a6236b89c8c060c65dabd300a1c8ce7c10edb72
F src/hash.h cd0433998bc1a3759d244e1637fe5a3c13b53bf8 F src/hash.h cd0433998bc1a3759d244e1637fe5a3c13b53bf8
F src/insert.c 9bc794863ea2988a7b8667ef010b3c46b26dba38 F src/insert.c 9bc794863ea2988a7b8667ef010b3c46b26dba38
F src/main.c 553efc8e20cab91c9968db55370b9a53a87a52e7 F src/main.c bbf5b5536c90b6e4e9202dd1b942ae236365784e
F src/md5.c 0ae1f3e2cac92d06fc6246d1b4b8f61a2fe66d3b F src/md5.c 0ae1f3e2cac92d06fc6246d1b4b8f61a2fe66d3b
F src/os.c edb22daad525f49681f41c76683a16c1d39755c7 F src/os.c edb22daad525f49681f41c76683a16c1d39755c7
F src/os.h 5b9a69875c880d1665ae040cbca1f7b9c82198ab F src/os.h 5b9a69875c880d1665ae040cbca1f7b9c82198ab
@ -62,7 +62,7 @@ F test/btree2.test e3b81ec33dc2f89b3e6087436dfe605b870c9080
F test/btree3.test 9caa9e22491dd8cd8aa36d7ac3b48b089817c895 F test/btree3.test 9caa9e22491dd8cd8aa36d7ac3b48b089817c895
F test/conflict.test 4518cc3c1c40c4ba74220d9ee814257ae7d09c47 F test/conflict.test 4518cc3c1c40c4ba74220d9ee814257ae7d09c47
F test/copy.test 92e21ebea11319c3f70448d3763fdaa0e2f1c21f F test/copy.test 92e21ebea11319c3f70448d3763fdaa0e2f1c21f
F test/delete.test c904a62129fe102b314a96111a8417f10249e4d8 F test/delete.test 5821a95a66061ae09723a88938f23d10d8a881ad
F test/expr.test 5fadd0bc87c223b424ce6752b576c1df346abf1f F test/expr.test 5fadd0bc87c223b424ce6752b576c1df346abf1f
F test/func.test cae5f27e09736cfdcc978c3719ac1345405b848c F test/func.test cae5f27e09736cfdcc978c3719ac1345405b848c
F test/in.test e59461f1702b7387880bf08a0ce6bb777925d282 F test/in.test e59461f1702b7387880bf08a0ce6bb777925d282
@ -107,7 +107,7 @@ F test/trigger3.test 7dfe798d7e72c13720394685fe353112e3f31adf
F test/unique.test 572aa791327c1e8d797932263e9d67f176cfdb44 F test/unique.test 572aa791327c1e8d797932263e9d67f176cfdb44
F test/update.test 7ffb062d580a972e7870d0f51d5af3ab9bfeae08 F test/update.test 7ffb062d580a972e7870d0f51d5af3ab9bfeae08
F test/vacuum.test 059871b312eb910bbe49dafde1d01490cc2c6bbe F test/vacuum.test 059871b312eb910bbe49dafde1d01490cc2c6bbe
F test/version.test 3a4d507ad9a7d4f7e2ce829b7896e399c8372ef1 F test/version.test 946589ce15d214443b8377b69d176551e6b32b34
F test/view.test 3afca084dab44c7a5772d3c6a326adf93ad52050 F test/view.test 3afca084dab44c7a5772d3c6a326adf93ad52050
F test/where.test 1f87bec674bf85d74ac1cc5b2cd3d89be1e87b1d F test/where.test 1f87bec674bf85d74ac1cc5b2cd3d89be1e87b1d
F tool/diffdb.c 7524b1b5df217c20cd0431f6789851a4e0cb191b F tool/diffdb.c 7524b1b5df217c20cd0431f6789851a4e0cb191b
@ -127,7 +127,7 @@ F www/arch.png 82ef36db1143828a7abc88b1e308a5f55d4336f4
F www/arch.tcl 72a0c80e9054cc7025a50928d28d9c75c02c2b8b F www/arch.tcl 72a0c80e9054cc7025a50928d28d9c75c02c2b8b
F www/audit.tcl 90e09d580f79c7efec0c7d6f447b7ec5c2dce5c0 F www/audit.tcl 90e09d580f79c7efec0c7d6f447b7ec5c2dce5c0
F www/c_interface.tcl 580c03f096a16c0cf7ce18e0483daace4a602b46 F www/c_interface.tcl 580c03f096a16c0cf7ce18e0483daace4a602b46
F www/changes.tcl 899174e0f3b0c32be054b9d09d9a3bddba82752b F www/changes.tcl c920fe01975e4eac1333e075134aa857b6ebee32
F www/conflict.tcl 81dd21f9a679e60aae049e9dd8ab53d59570cda2 F www/conflict.tcl 81dd21f9a679e60aae049e9dd8ab53d59570cda2
F www/crosscompile.tcl 3622ebbe518927a3854a12de51344673eb2dd060 F www/crosscompile.tcl 3622ebbe518927a3854a12de51344673eb2dd060
F www/download.tcl 29aa6679ca29621d10613f60ebbbda18f4b91c49 F www/download.tcl 29aa6679ca29621d10613f60ebbbda18f4b91c49
@ -142,7 +142,7 @@ F www/speed.tcl da8afcc1d3ccc5696cfb388a68982bc3d9f7f00f
F www/sqlite.tcl ae3dcfb077e53833b59d4fcc94d8a12c50a44098 F www/sqlite.tcl ae3dcfb077e53833b59d4fcc94d8a12c50a44098
F www/tclsqlite.tcl 1db15abeb446aad0caf0b95b8b9579720e4ea331 F www/tclsqlite.tcl 1db15abeb446aad0caf0b95b8b9579720e4ea331
F www/vdbe.tcl 2013852c27a02a091d39a766bc87cff329f21218 F www/vdbe.tcl 2013852c27a02a091d39a766bc87cff329f21218
P c8a7b725b7cec792d2148455a4cecbce9dfebe80 P 712ee3914e988f0077e9a3d6170ff8db496a9600
R 4b70b10f72657c3aef30cab2e450b1e2 R e18ddbb4d34c611c8ea2fbb6bf8125f5
U drh U drh
Z e6d57a6a86a2d8ecbb750e666c311e5b Z ac4011cc1c3100f3850516aaff92f5b7

View File

@ -1 +1 @@
712ee3914e988f0077e9a3d6170ff8db496a9600 612df004017b241651074ee859096dd0ee5062b8

View File

@ -12,7 +12,7 @@
** This file contains C code routines that are called by the parser ** This file contains C code routines that are called by the parser
** to handle DELETE FROM statements. ** to handle DELETE FROM statements.
** **
** $Id: delete.c,v 1.40 2002/07/18 00:34:11 drh Exp $ ** $Id: delete.c,v 1.41 2002/07/19 18:52:41 drh Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
@ -170,13 +170,12 @@ void sqliteDeleteFrom(
int endOfLoop = sqliteVdbeMakeLabel(v); int endOfLoop = sqliteVdbeMakeLabel(v);
int addr; int addr;
openOp = pTab->isTemp ? OP_OpenAux : OP_Open; openOp = pTab->isTemp ? OP_OpenAux : OP_Open;
assert( base==0 ); sqliteVdbeAddOp(v, openOp, base, pTab->tnum);
sqliteVdbeAddOp(v, openOp, 0, pTab->tnum); sqliteVdbeAddOp(v, OP_Rewind, base, sqliteVdbeCurrentAddr(v)+2);
sqliteVdbeAddOp(v, OP_Rewind, 0, sqliteVdbeCurrentAddr(v)+2);
addr = sqliteVdbeAddOp(v, OP_AddImm, 1, 0); addr = sqliteVdbeAddOp(v, OP_AddImm, 1, 0);
sqliteVdbeAddOp(v, OP_Next, 0, addr); sqliteVdbeAddOp(v, OP_Next, base, addr);
sqliteVdbeResolveLabel(v, endOfLoop); sqliteVdbeResolveLabel(v, endOfLoop);
sqliteVdbeAddOp(v, OP_Close, 0, 0); sqliteVdbeAddOp(v, OP_Close, base, 0);
} }
sqliteVdbeAddOp(v, OP_Clear, pTab->tnum, pTab->isTemp); sqliteVdbeAddOp(v, OP_Clear, pTab->tnum, pTab->isTemp);
for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){ for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){

View File

@ -14,7 +14,7 @@
** other files are for internal use by SQLite and should not be ** other files are for internal use by SQLite and should not be
** accessed by users of the library. ** accessed by users of the library.
** **
** $Id: main.c,v 1.90 2002/07/19 18:13:36 drh Exp $ ** $Id: main.c,v 1.91 2002/07/19 18:52:41 drh Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
#include "os.h" #include "os.h"
@ -115,7 +115,7 @@ int upgrade_3_callback(void *pInit, int argc, char **argv, char **NotUsed){
int rc; int rc;
Table *pTab; Table *pTab;
Trigger *pTrig; Trigger *pTrig;
char *zErr; char *zErr = 0;
pTab = sqliteFindTable(pData->db, argv[0]); pTab = sqliteFindTable(pData->db, argv[0]);
if( pTab ){ if( pTab ){
@ -302,7 +302,7 @@ int sqliteInit(sqlite *db, char **pzErrMsg){
/* /*
** The version of the library ** The version of the library
*/ */
static const char rcsid[] = "@(#) $Id: main.c,v 1.90 2002/07/19 18:13:36 drh Exp $"; static const char rcsid[] = "@(#) $Id: main.c,v 1.91 2002/07/19 18:52:41 drh Exp $";
const char sqlite_version[] = SQLITE_VERSION; const char sqlite_version[] = SQLITE_VERSION;
/* /*

View File

@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The # This file implements regression tests for SQLite library. The
# focus of this file is testing the DELETE FROM statement. # focus of this file is testing the DELETE FROM statement.
# #
# $Id: delete.test,v 1.10 2001/10/15 00:44:36 drh Exp $ # $Id: delete.test,v 1.11 2002/07/19 18:52:41 drh Exp $
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
source $testdir/tester.tcl source $testdir/tester.tcl
@ -193,6 +193,53 @@ do_test delete-6.10 {
execsql {SELECT f1 FROM table2} execsql {SELECT f1 FROM table2}
} {2} } {2}
do_test delete-7.1 {
execsql {
CREATE TABLE t3(a);
INSERT INTO t3 VALUES(1);
INSERT INTO t3 SELECT a+1 FROM t3;
INSERT INTO t3 SELECT a+2 FROM t3;
SELECT * FROM t3;
}
} {1 2 3 4}
do_test delete-7.2 {
execsql {
CREATE TABLE cnt(del);
INSERT INTO cnt VALUES(0);
CREATE TRIGGER r1 AFTER DELETE ON t3 FOR EACH ROW BEGIN
UPDATE cnt SET del=del+1;
END;
DELETE FROM t3 WHERE a<2;
SELECT * FROM t3;
}
} {2 3 4}
do_test delete-7.3 {
execsql {
SELECT * FROM cnt;
}
} {1}
do_test delete-7.4 {
execsql {
DELETE FROM t3;
SELECT * FROM t3;
}
} {}
do_test delete-7.5 {
execsql {
SELECT * FROM cnt;
}
} {4}
do_test delete-7.6 {
execsql {
INSERT INTO t3 VALUES(1);
INSERT INTO t3 SELECT a+1 FROM t3;
INSERT INTO t3 SELECT a+2 FROM t3;
CREATE TABLE t4 AS SELECT * FROM t3;
PRAGMA count_changes=ON;
DELETE FROM t3;
DELETE FROM t4;
}
} {4 4}
finish_test finish_test

View File

@ -12,7 +12,7 @@
# focus of this file is testing the ability of the library to detect # focus of this file is testing the ability of the library to detect
# past or future file format version numbers and respond appropriately. # past or future file format version numbers and respond appropriately.
# #
# $Id: version.test,v 1.3 2002/07/19 17:46:41 drh Exp $ # $Id: version.test,v 1.4 2002/07/19 18:52:41 drh Exp $
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
source $testdir/tester.tcl source $testdir/tester.tcl
@ -178,5 +178,16 @@ do_test version-2.1 {
set rc [catch {sqlite db test.db} msg] set rc [catch {sqlite db test.db} msg]
lappend rc $msg lappend rc $msg
} {1 {unable to upgrade database to the version 2.6 format: attempt to write a readonly database}} } {1 {unable to upgrade database to the version 2.6 format: attempt to write a readonly database}}
do_test version-2.2 {
file delete -force test.db
set fd [open test.db w]
set txt "This is not a valid database file\n"
while {[string length $txt]<4092} {append txt $txt}
puts $fd $txt
close $fd
set rc [catch {sqlite db test.db} msg]
lappend rc $msg
} {1 {}}
finish_test finish_test

View File

@ -25,7 +25,16 @@ proc chng {date desc} {
puts "<DD><P><UL>$desc</UL></P></DD>" puts "<DD><P><UL>$desc</UL></P></DD>"
} }
chng {2002 Jly 7 (2.6.0)} { chng {2002 Jly 19 (2.6.1)} {
<li>Include a static string in the library that responds to the RCS
"ident" command and which contains the library version number.</li>
<li>Fix an assertion failure that occurred when deleting all rows of
a table with the "count_changes" pragma turned on.</li>
<li>Better error reporting when problems occur during the automatic
2.5.6 to 2.6.0 database format upgrade.</li>
}
chng {2002 Jly 17 (2.6.0)} {
<li>Change the format of indices to correct a design flaw the originated <li>Change the format of indices to correct a design flaw the originated
with version 2.1.0. <font color="red">*** This is an incompatible with version 2.1.0. <font color="red">*** This is an incompatible
file format change ***</font> When version 2.6.0 or later of the file format change ***</font> When version 2.6.0 or later of the