Compare commits

...

3 Commits

Author SHA1 Message Date
drh 75c3edf8eb Version 2.2.2 (CVS 451)
FossilOrigin-Name: 7da00a33fece0b03b88c5103ce2b57e4d74ba2e4
2002-01-14 03:00:00 +00:00
drh 9647ff85fe Fix a bug that could cause UPDATE to fail for a table that contains
both an INTEGER PRIMARY KEY and an index. (CVS 346)

FossilOrigin-Name: 96cd07a881d7bea86a66d7dfe54713be9c81cb4c
2002-01-14 02:56:24 +00:00
drh da9e034610 Fix a problem with the way temporary tables mask permanent tables. (CVS 345)
FossilOrigin-Name: ba89da603135e5f63f6f97ba3adad02682375c07
2002-01-10 14:31:48 +00:00
10 changed files with 171 additions and 59 deletions
+1 -1
View File
@@ -1 +1 @@
2.2.1
2.2.2
+13 -13
View File
@@ -1,9 +1,9 @@
C Version\s2.2.1\s(CVS\s452)
D 2002-01-09T13:45:00
C Version\s2.2.2\s(CVS\s451)
D 2002-01-14T03:00:00
F Makefile.in 9fa4277413bf1d9cf91365f07d4108d7d87ed2af
F Makefile.template c88ffcb9c339e718f434d0c7f045bcd7eea125af
F README a4c0ba11354ef6ba0776b400d057c59da47a4cc0
F VERSION 6565c509ed61af074681258bd346dca53ad38128
F VERSION e4851f0e1fd8b7411787e28c5062067c23d706f1
F aclocal.m4 11faa843caa38fd451bc6aeb43e248d1723a269d
F config.guess f38b1e93d1e0fa6f5a6913e9e7b12774b9232588
F config.log 6a73d03433669b10a3f0c221198c3f26b9413914
@@ -21,13 +21,13 @@ F sqlite.1 2e2bb0529ef468ade9e4322bd609d0695fb9ded9
F src/TODO af7f3cab0228e34149cf98e073aa83d45878e7e6
F src/btree.c c796e387da340cb628dc1e41f684fc20253f561e
F src/btree.h 9ead7f54c270d8a554e59352ca7318fdaf411390
F src/build.c 1acab23d8d5ef447e16c2b270262fcb18d6c0d90
F src/build.c d44fbcfaf0eacd33a4686aa4dda8fc770b640421
F src/delete.c f7690efc09ad6a2f1f3f0490e1b0cbb676bb95cf
F src/expr.c 8169261ac56e96c860407a8773ca10b779e32328
F src/hash.c 838a6f2af547dfdc5ff2b438e8f981ea4b74f224
F src/hash.h a5f5b3ce2d086a172c5879b0b06a27a82eac9fac
F src/insert.c 813c37719866c583e6ca7660f94f10230f4e385d
F src/main.c 46c752711300f1994be4162aaa59cbfb9db0c11e
F src/main.c bdce5ed20f2828cd5b390c3880d5820b70e09871
F src/md5.c 52f677bfc590e09f71d07d7e327bd59da738d07c
F src/os.c 07882cde5c61f26751b8ee76fd84726c1f7e453c
F src/os.h 00a18e0ae1139a64f1d3ead465ae2b9ff43f3db2
@@ -47,7 +47,7 @@ F src/test1.c 41eabe255970ef947263b94145c9b2766bab8675
F src/test2.c e9f99aa5ee73872819259d6612c11e55e1644321
F src/test3.c d6775f95fd91f5b3cf0e2382a28e5aaeb68f745b
F src/tokenize.c 830e9ef684334070a26583d94770bb869e2727bf
F src/update.c f9f48e78c13c79e32a55840414bea84479f9848d
F src/update.c 5cb326ed4bace89cbad7d919b828da6c2a9064e4
F src/util.c 8e9ca72d8288cae39c57c6f397abd14a56b14a38
F src/vdbe.c b27b256a5930da1e8fc347a272357be72de0f853
F src/vdbe.h e5cc6fb13d1905a4339db4d6dba4ab393c0765fa
@@ -65,7 +65,7 @@ F test/in.test 9323681388be301dc73f370b4cd62c5a33f79d1e
F test/index.test c8a471243bbf878974b99baf5badd59407237cf3
F test/insert.test a5c122aa726f1cef6f07d6767e8fd6f220994c11
F test/insert2.test d6901ca931e308fea7fca8c95ebe7dc957cc9fc2
F test/intpkey.test c5776456778f4062a8355467704df9c501ab3e1c
F test/intpkey.test c9f427cb7b74835deeef112ed7f2af13d2ad662b
F test/ioerr.test 57d9bffaca18b34f9e976f786eadc2591d6efc6a
F test/limit.test a930f3eba2a7691c8397ccab33710b931589566a
F test/lock.test 19593689260c419efe7ced55b1418653a4b7bcd1
@@ -87,9 +87,9 @@ F test/subselect.test 335d3dad8d585726c447dfee8d9c4f7383c76b78
F test/table.test 3ef4254d62ece31a3872ab11cdaec846f6fa8fd1
F test/tableapi.test 51d0c209aa6b1158cb952ec917c656d4ce66e9e4
F test/tclsqlite.test feca0f2b23ba51d202d67d71e10ba7a8a1621f82
F test/temptable.test 37acd9e39781c2ff7cff2ba741b6b27ce020a44a
F test/temptable.test 0e9934283259a5e637eec756a7eefd6964c0f79b
F test/tester.tcl 96db1b49157388edb57e11bf33285e3811a897e4
F test/trans.test 9306ee5e47e36d0c99185ab33326f988567a868d
F test/trans.test 9e49495c06b1c41f889bf4f0fb195a015b126de0
F test/unique.test 07776624b82221a80c8b4138ce0dd8b0853bb3ea
F test/update.test 3cf1ca0565f678063c2dfa9a7948d2d66ae1a778
F test/vacuum.test 8acf8669f3b627e54149b25165b034aa06c2432e
@@ -105,7 +105,7 @@ F www/arch.fig d5f9752a4dbf242e9cfffffd3f5762b6c63b3bcf
F www/arch.png 82ef36db1143828a7abc88b1e308a5f55d4336f4
F www/arch.tcl 72a0c80e9054cc7025a50928d28d9c75c02c2b8b
F www/c_interface.tcl 9123810452845783fac8e3184929463d9e70d609
F www/changes.tcl 33d23e9b4a41665d1f88e0e5d87a1c891b223080
F www/changes.tcl cf67e8dec21d813c48f3cecc00bbfa6bd397dd69
F www/crosscompile.tcl 3622ebbe518927a3854a12de51344673eb2dd060
F www/download.tcl 1ea61f9d89a2a5a9b2cee36b0d5cf97321bdefe0
F www/dynload.tcl 02eb8273aa78cfa9070dd4501dca937fb22b466c
@@ -119,7 +119,7 @@ F www/speed.tcl 83457b2bf6bb430900bd48ca3dd98264d9a916a5
F www/sqlite.tcl 8b5884354cb615049aed83039f8dfe1552a44279
F www/tclsqlite.tcl 880ef67cb4f2797b95bf1368fc4e0d8ca0fda956
F www/vdbe.tcl 2013852c27a02a091d39a766bc87cff329f21218
P e78b1ea23ccda4bc476fbb070586dcac2cc83331
R af480a8ae42089cfdb3a02b61e4f93f1
P 96cd07a881d7bea86a66d7dfe54713be9c81cb4c
R a1a9962b00d5c92a1a7c16dd24629b0d
U drh
Z 3dbcd152ef063de125b37abe863b56e2
Z 4dbf22ff719a9b7e3428eeb6319e1299
+1 -1
View File
@@ -1 +1 @@
61c38f3bfef430f39aa98e9e7fa37324132b4381
7da00a33fece0b03b88c5103ce2b57e4d74ba2e4
+4 -3
View File
@@ -25,7 +25,7 @@
** ROLLBACK
** PRAGMA
**
** $Id: build.c,v 1.63 2002/01/09 13:30:41 drh Exp $
** $Id: build.c,v 1.64 2002/01/10 14:31:49 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
@@ -205,7 +205,7 @@ void sqliteUnlinkAndDeleteIndex(sqlite *db, Index *pIndex){
** executed. If a ROLLBACK occurs, the indices are moved back into
** the main index hash table.
*/
void sqlitePendingDropIndex(sqlite *db, Index *p){
static void sqlitePendingDropIndex(sqlite *db, Index *p){
if( !p->isCommit ){
sqliteUnlinkAndDeleteIndex(db, p);
}else{
@@ -273,7 +273,7 @@ static void sqliteUnlinkAndDeleteTable(sqlite *db, Table *p){
** then the tables on the drop queue are moved back into the main
** hash table.
*/
void sqlitePendingDropTable(sqlite *db, Table *pTbl){
static void sqlitePendingDropTable(sqlite *db, Table *pTbl){
if( !pTbl->isCommit ){
sqliteUnlinkAndDeleteTable(db, pTbl);
}else{
@@ -954,6 +954,7 @@ void sqliteCreateIndex(
zName = 0;
sqliteSetString(&zName, "(", pTab->zName, " autoindex ", zBuf, 0);
if( zName==0 ) goto exit_create_index;
hideName = sqliteFindIndex(db, zName)!=0;
}
/* If pList==0, it means this routine was called to make a primary
+7 -2
View File
@@ -14,7 +14,7 @@
** other files are for internal use by SQLite and should not be
** accessed by users of the library.
**
** $Id: main.c,v 1.54 2002/01/09 03:20:00 drh Exp $
** $Id: main.c,v 1.55 2002/01/10 14:31:49 drh Exp $
*/
#include "sqliteInt.h"
#include "os.h"
@@ -73,7 +73,12 @@ static int sqliteOpenCb(void *pDb, int argc, char **argv, char **azColName){
*/
Index *pIndex = sqliteFindIndex(db, argv[1]);
if( pIndex==0 || pIndex->tnum!=0 ){
nErr++;
/* This can occur if there exists an index on a TEMP table which
** has the same name as another index on a permanent index. Since
** the permanent table is hidden by the TEMP table, we can also
** safely ignore the index on the permanent table.
*/
/* Do Nothing */;
}else{
pIndex->tnum = atoi(argv[2]);
}
+2 -2
View File
@@ -12,7 +12,7 @@
** This file contains C code routines that are called by the parser
** to handle UPDATE statements.
**
** $Id: update.c,v 1.25 2001/12/31 02:48:51 drh Exp $
** $Id: update.c,v 1.26 2002/01/14 02:56:25 drh Exp $
*/
#include "sqliteInt.h"
@@ -101,7 +101,7 @@ void sqliteUpdate(
}
for(j=0; j<pTab->nCol; j++){
if( sqliteStrICmp(pTab->aCol[j].zName, pChanges->a[i].zName)==0 ){
if( i==pTab->iPKey ){
if( j==pTab->iPKey ){
chngRecno = 1;
pRecnoExpr = pChanges->a[i].pExpr;
}
+23 -1
View File
@@ -13,7 +13,7 @@
# This file implements tests for the special processing associated
# with INTEGER PRIMARY KEY columns.
#
# $Id: intpkey.test,v 1.4 2001/12/22 21:48:30 drh Exp $
# $Id: intpkey.test,v 1.5 2002/01/14 02:56:26 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -411,4 +411,26 @@ do_test intpkey-7.2 {
}
} {22 b-22 c-22 30 new row}
# Do an insert from a select statement.
#
do_test intpkey-8.1 {
execsql {
CREATE TABLE t2(x INTEGER PRIMARY KEY, y, z);
INSERT INTO t2 SELECT * FROM t1;
SELECT rowid FROM t2;
}
} {-4 0 5 6 11 20 22 30}
do_test intpkey-8.2 {
execsql {
SELECT x FROM t2;
}
} {-4 0 5 6 11 20 22 30}
do_test intpkey-9.1 {
execsql {
UPDATE t1 SET c='www' WHERE c='world';
SELECT rowid, a, c FROM t1 WHERE c=='www';
}
} {5 5 www 11 11 www}
finish_test
+104 -33
View File
@@ -12,7 +12,7 @@
#
# This file implements tests for temporary tables and indices.
#
# $Id: temptable.test,v 1.3 2001/10/09 12:39:24 drh Exp $
# $Id: temptable.test,v 1.4 2002/01/10 14:31:49 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -148,11 +148,11 @@ do_test temptable-3.4 {
# hides the existance of the permanent table.
#
do_test temptable-4.1 {
db2 eval {
execsql {
CREATE TEMP TABLE t2(x,y);
INSERT INTO t2 VALUES(10,20);
SELECT * FROM t2;
}
} db2
} {10 20}
do_test temptable-4.2 {
execsql {
@@ -162,68 +162,139 @@ do_test temptable-4.2 {
}
} {9 8 7}
do_test temptable-4.3 {
set r [catch {db2 eval {SELECT * FROM t2}} msg]
lappend r $msg
catchsql {
SELECT * FROM t2;
} db2
} {1 {database schema has changed}}
do_test temptable-4.4 {
set r [catch {db2 eval {SELECT * FROM t2}} msg]
lappend r $msg
catchsql {
SELECT * FROM t2;
} db2
} {0 {10 20}}
do_test temptable-4.5 {
db2 eval {DROP TABLE t2}
set r [catch {db2 eval {SELECT * FROM t2}} msg]
lappend r $msg
catchsql {
DROP TABLE t2;
SELECT * FROM t2;
} db2
} {1 {no such table: t2}}
do_test temptable-4.6 {
db2 close
sqlite db2 ./test.db
set r [catch {db2 eval {SELECT * FROM t2}} msg]
lappend r $msg
catchsql {
SELECT * FROM t2;
} db2
} {0 {9 8 7}}
do_test temptable-4.7 {
catchsql {
DROP TABLE t2;
SELECT * FROM t2;
}
} {1 {no such table: t2}}
do_test temptable-4.8 {
db2 close
sqlite db2 ./test.db
execsql {
CREATE TEMP TABLE t2(x unique,y);
INSERT INTO t2 VALUES(1,2);
SELECT * FROM t2;
} db2
} {1 2}
do_test temptable-4.9 {
execsql {
CREATE TABLE t2(x unique, y);
INSERT INTO t2 VALUES(3,4);
SELECT * FROM t2;
}
} {3 4}
do_test temptable-4.10 {
catchsql {
SELECT * FROM t2;
} db2
} {1 {database schema has changed}}
do_test temptable-4.11 {
execsql {
SELECT * FROM t2;
} db2
} {1 2}
do_test temptable-4.12 {
execsql {
SELECT * FROM t2;
}
} {3 4}
do_test temptable-4.13 {
catchsql {
DROP TABLE t2;
SELECT * FROM t2;
} db2
} {1 {no such table: t2}}
do_test temptable-4.14 {
execsql {
SELECT * FROM t2;
}
} {3 4}
do_test temptable-4.15 {
db2 close
sqlite db2 ./test.db
execsql {
SELECT * FROM t2;
} db2
} {3 4}
# Now create a temporary table in db2 and a permanent index in db. The
# temporary table in db2 should mask the name of the permanent index,
# but the permanent index should still be accessible and should still
# be updated when its correspnding table changes.
# be updated when its corresponding table changes.
#
do_test temptable-5.1 {
db2 eval {CREATE TEMP TABLE mask(a,b,c)}
execsql {
CREATE TEMP TABLE mask(a,b,c)
} db2
execsql {
CREATE INDEX mask ON t2(x);
SELECT * FROM t2;
}
} {9 8 7}
} {3 4}
do_test temptable-5.2 {
set r [catch {db2 eval {SELECT * FROM t2}} msg]
lappend r $msg
catchsql {
SELECT * FROM t2;
} db2
} {1 {database schema has changed}}
do_test temptable-5.3 {
set r [catch {db2 eval {SELECT * FROM t2}} msg]
lappend r $msg
} {0 {9 8 7}}
catchsql {
SELECT * FROM t2;
} db2
} {0 {3 4}}
do_test temptable-5.4 {
execsql {SELECT y FROM t2 WHERE x=9}
} {8}
do_test temptable-5.5 {
db2 eval {SELECT y FROM t2 WHERE x=9}
} {8}
do_test temptable-5.6 {
db2 eval {
INSERT INTO t2 VALUES(1,2,3);
SELECT y FROM t2 WHERE x=1;
execsql {
SELECT y FROM t2 WHERE x=3
}
} {4}
do_test temptable-5.5 {
execsql {
SELECT y FROM t2 WHERE x=3
} db2
} {4}
do_test temptable-5.6 {
execsql {
INSERT INTO t2 VALUES(1,2);
SELECT y FROM t2 WHERE x=1;
} db2
} {2}
do_test temptable-5.7 {
db2 eval {SELECT y FROM t2 WHERE x=9}
} {8}
execsql {
SELECT y FROM t2 WHERE x=3
} db2
} {4}
do_test temptable-5.8 {
execsql {
SELECT y FROM t2 WHERE x=1;
}
} {2}
do_test temptable-5.9 {
execsql {SELECT y FROM t2 WHERE x=9}
} {8}
execsql {
SELECT y FROM t2 WHERE x=3
}
} {4}
db2 close
+9 -3
View File
@@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The
# focus of this script is database locks.
#
# $Id: trans.test,v 1.9 2002/01/09 13:30:42 drh Exp $
# $Id: trans.test,v 1.10 2002/01/10 14:31:49 drh Exp $
set testdir [file dirname $argv0]
@@ -646,13 +646,19 @@ do_test trans-6.36 {
SELECT * FROM t1 WHERE c<1;
}
} {4 -5 -6 1 -2 -3}
do_test trans-6.36 {
do_test trans-6.37 {
execsql {
DROP INDEX i1;
SELECT * FROM t1 WHERE c<1;
}
} {1 -2 -3 4 -5 -6}
do_test trans-6.38 {
execsql {
ROLLBACK;
SELECT * FROM t1 WHERE b<1;
}
} {4 -5 -6 1 -2 -3}
do_test trans-6.38 {
do_test trans-6.39 {
execsql {
SELECT * FROM t1 WHERE c<1;
}
+7
View File
@@ -17,6 +17,13 @@ proc chng {date desc} {
puts "<DD><P><UL>$desc</UL></P></DD>"
}
chng {2002 Jan 13 (2.2.2)} {
<li>Bug fix: An assertion was failing when a temporary table with an index
had the same name as a permanent table created by a separate process.</li>
<li>Bug fix: Updates to tables containing an INTEGER PRIMARY KEY and an
index could fail.</li>
}
chng {2002 Jan 9 (2.2.1)} {
<li>Bug fix: An attempt to delete a single row of a table with a WHERE
clause of "ROWID=x" when no such rowid exists was causing an error.</li>