Reindex tests added and bugs fixed. (CVS 2075)
FossilOrigin-Name: ad433ec2b6bd34e33dfe119668f38fbb978e889d
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
C Auto-vacuum:\sEnsure\spages\sto\sbe\sremoved\sby\sdatabase\struncation\sare\sin\sthe\sjournal\sfile.\sAlso\sfix\san\ssqlite3pager_movepage()\sbug.\s(CVS\s2074)
|
||||
D 2004-11-06T12:26:08
|
||||
C Reindex\stests\sadded\sand\sbugs\sfixed.\s(CVS\s2075)
|
||||
D 2004-11-07T13:01:50
|
||||
F Makefile.in c4d2416860f472a1e3393714d0372074197565df
|
||||
F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457
|
||||
F README a01693e454a00cc117967e3f9fdab2d4d52e9bc1
|
||||
@@ -31,7 +31,7 @@ F src/attach.c e49d09dad9f5f9fb10b4b0c1be5a70ae4c45e689
|
||||
F src/auth.c 3b81f2a42f48a62c2c9c9b0eda31a157c681edea
|
||||
F src/btree.c 8ae13efe790fc462ee590ba96e1940f4c943fe19
|
||||
F src/btree.h 861e40b759a195ba63819740e484390012cf81ab
|
||||
F src/build.c fba59507d36d27effbeba59bdd2a720071b7673a
|
||||
F src/build.c f01c2f9b3ad334a301e97ee4f299c36228ead110
|
||||
F src/date.c 34bdb0082db7ec2a83ef00063f7b44e61ee19dad
|
||||
F src/delete.c f0af21a1ede15524a5edd59fe10ef486283a1ee9
|
||||
F src/expr.c be18081d2959a2cc53846d0fbedfec40fbfa1d6e
|
||||
@@ -123,8 +123,8 @@ F test/fkey1.test 81bb13caaa78f58d7d191d7f535529f7c91d821a
|
||||
F test/func.test 830d352574c7f5cd15149a9be58a6dcc2b995c05
|
||||
F test/hook.test f8605cde4c77b2c6a4a73723bf6c507796a64dda
|
||||
F test/in.test b92a2df9162e1cbd33c6449a29a05e6955b1741a
|
||||
F test/index.test 4098cd020180bec286ef1a96bca256e76cc7b654
|
||||
F test/insert.test c571223b499961d843ce0ab4709c87fa60ab2425
|
||||
F test/index.test 5776a3ebcbe0bdc69e7eeaeb5e95dfba6b17389e
|
||||
F test/insert.test 989bc184e2965dea397a41bca4369352661079ab
|
||||
F test/insert2.test 614a29d3ed7dd0d8644a059c6d8ce742c63a734a
|
||||
F test/interrupt.test 5c336baaf810e5f7a91d2f01e2cafca480885dfe
|
||||
F test/intpkey.test b57cf5236fde1bd8cbc1388fa0c91908f6fd9194
|
||||
@@ -160,7 +160,7 @@ F test/printf.test 92ba4c510b4fc61120ffa4a01820446ed917ae57
|
||||
F test/progress.test 5ddba78cb6011fba36093973cfb3ac473b8fb96a x
|
||||
F test/quick.test 2dca186ebd5c418a7699944ba3b5e437d765eddd
|
||||
F test/quote.test 6d75cf635d93ba2484dc9cb378d88cbae9dc2c62
|
||||
F test/reindex.test 1d579cdb942c5f9c26c7f8c94cdc3024cabf2644
|
||||
F test/reindex.test 3552c6b944a3fab28cfd3049c04c65cb79419757
|
||||
F test/rollback.test 4097328d44510277244ef4fa51b22b2f11d7ef4c
|
||||
F test/rowid.test 1ce3f1520d2082b0363e7d9bdef904cb72b9efe8
|
||||
F test/select1.test 0e459a8066259445d707cc4f64ea00459441e29f
|
||||
@@ -253,7 +253,7 @@ F www/tclsqlite.tcl 560ecd6a916b320e59f2917317398f3d59b7cc25
|
||||
F www/vdbe.tcl 59288db1ac5c0616296b26dce071c36cb611dfe9
|
||||
F www/version3.tcl 092a01f5ef430d2c4acc0ae558d74c4bb89638a0
|
||||
F www/whentouse.tcl fdacb0ba2d39831e8a6240d05a490026ad4c4e4c
|
||||
P 89b9026a5371f1c5589f04e3b69171ec1f605b7b
|
||||
R 8ad60b55265f20042b59f34c42d3206d
|
||||
U danielk1977
|
||||
Z 6d567165f557419cc4b6243e52dc95f0
|
||||
P 081676e491760a45325e2349b177d6382faab9f5
|
||||
R 6630382fc7d25a2e7888b420a0d94622
|
||||
U drh
|
||||
Z 052f1c7409b37943337cd90fbf34df5d
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
081676e491760a45325e2349b177d6382faab9f5
|
||||
ad433ec2b6bd34e33dfe119668f38fbb978e889d
|
||||
+6
-5
@@ -22,7 +22,7 @@
|
||||
** COMMIT
|
||||
** ROLLBACK
|
||||
**
|
||||
** $Id: build.c,v 1.272 2004/11/06 00:02:48 drh Exp $
|
||||
** $Id: build.c,v 1.273 2004/11/07 13:01:50 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include <ctype.h>
|
||||
@@ -2318,13 +2318,14 @@ void sqlite3CreateIndex(
|
||||
pName->z);
|
||||
}else{
|
||||
/* An automatic index created by a PRIMARY KEY or UNIQUE constraint */
|
||||
zStmt = sqlite3MPrintf("");
|
||||
/* zStmt = sqlite3MPrintf(""); */
|
||||
zStmt = 0;
|
||||
}
|
||||
|
||||
/* Add an entry in sqlite_master for this index
|
||||
*/
|
||||
sqlite3NestedParse(pParse,
|
||||
"INSERT INTO %Q.%s VALUES('index',%Q,%Q,#0,'%s');",
|
||||
"INSERT INTO %Q.%s VALUES('index',%Q,%Q,#0,%Q);",
|
||||
db->aDb[iDb].zName, SCHEMA_TABLE(iDb),
|
||||
pIndex->zName,
|
||||
pTab->zName,
|
||||
@@ -2841,10 +2842,10 @@ void sqlite3Reindex(Parse *pParse, Token *pName1, Token *pName2){
|
||||
sqlite3 *db = pParse->db; /* The database connection */
|
||||
Token *pObjName; /* Name of the table or index to be reindexed */
|
||||
|
||||
if( pName1==0 ){
|
||||
if( pName1==0 || pName1->z==0 ){
|
||||
reindexDatabases(pParse, 0);
|
||||
return;
|
||||
}else if( pName2==0 ){
|
||||
}else if( pName2==0 || pName2->z==0 ){
|
||||
pColl = sqlite3FindCollSeq(db, db->enc, pName1->z, pName1->n, 0);
|
||||
if( pColl ){
|
||||
reindexDatabases(pParse, pColl);
|
||||
|
||||
+15
-1
@@ -11,7 +11,7 @@
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this file is testing the CREATE INDEX statement.
|
||||
#
|
||||
# $Id: index.test,v 1.34 2004/11/04 04:42:28 drh Exp $
|
||||
# $Id: index.test,v 1.35 2004/11/07 13:01:50 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@@ -86,6 +86,13 @@ do_test index-3.1 {
|
||||
WHERE type='index' AND tbl_name='test1'
|
||||
ORDER BY name}
|
||||
} $r
|
||||
integrity_check index-3.2.1
|
||||
ifcapable {reindex} {
|
||||
do_test index-3.2.2 {
|
||||
execsql REINDEX
|
||||
} {}
|
||||
}
|
||||
integrity_check index-3.2.3
|
||||
|
||||
|
||||
# Verify that all the indices go away when we drop the table.
|
||||
@@ -654,6 +661,13 @@ do_test index-19.6 {
|
||||
}
|
||||
} {1 {conflicting ON CONFLICT clauses specified}}
|
||||
|
||||
ifcapable {reindex} {
|
||||
do_test index-19.7 {
|
||||
execsql REINDEX
|
||||
} {}
|
||||
}
|
||||
integrity_check index-19.8
|
||||
|
||||
# Drop index with a quoted name. Ticket #695.
|
||||
#
|
||||
do_test index-20.1 {
|
||||
|
||||
+11
-1
@@ -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.19 2004/11/03 16:27:02 drh Exp $
|
||||
# $Id: insert.test,v 1.20 2004/11/07 13:01:50 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@@ -160,6 +160,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}
|
||||
ifcapable {reindex} {
|
||||
do_test insert-3.5 {
|
||||
execsql REINDEX
|
||||
} {}
|
||||
}
|
||||
integrity_check insert-3.5
|
||||
|
||||
# Test of expressions in the VALUES clause
|
||||
@@ -293,6 +298,11 @@ do_test insert-6.4 {
|
||||
SELECT * FROM t1 WHERE b=3;
|
||||
}
|
||||
} {}
|
||||
ifcapable {reindex} {
|
||||
do_test insert-6.7 {
|
||||
execsql REINDEX
|
||||
} {}
|
||||
}
|
||||
|
||||
integrity_check insert-99.0
|
||||
|
||||
|
||||
+79
-1
@@ -11,7 +11,7 @@
|
||||
# This file implements regression tests for SQLite library.
|
||||
# This file implements tests for the REINDEX command.
|
||||
#
|
||||
# $Id: reindex.test,v 1.1 2004/11/05 23:46:15 drh Exp $
|
||||
# $Id: reindex.test,v 1.2 2004/11/07 13:01:50 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@@ -63,4 +63,82 @@ do_test reindex-1.9 {
|
||||
}
|
||||
} {1 {unable to identify the object to be reindexed}}
|
||||
|
||||
# Set up a table for testing that includes several different collating
|
||||
# sequences including some that we can modify.
|
||||
#
|
||||
do_test reindex-2.1 {
|
||||
proc c1 {a b} {
|
||||
return [expr {-[string compare $a $b]}]
|
||||
}
|
||||
proc c2 {a b} {
|
||||
return [expr {-[string compare [string tolower $a] [string tolower $b]]}]
|
||||
}
|
||||
db collate c1 c1
|
||||
db collate c2 c2
|
||||
execsql {
|
||||
CREATE TABLE t2(
|
||||
a TEXT PRIMARY KEY COLLATE c1,
|
||||
b TEXT UNIQUE COLLATE c2,
|
||||
c TEXT COLLATE nocase,
|
||||
d TEST COLLATE binary
|
||||
);
|
||||
INSERT INTO t2 VALUES('abc','abc','abc','abc');
|
||||
INSERT INTO t2 VALUES('ABCD','ABCD','ABCD','ABCD');
|
||||
INSERT INTO t2 VALUES('bcd','bcd','bcd','bcd');
|
||||
INSERT INTO t2 VALUES('BCDE','BCDE','BCDE','BCDE');
|
||||
SELECT a FROM t2 ORDER BY a;
|
||||
}
|
||||
} {bcd abc BCDE ABCD}
|
||||
do_test reindex-2.2 {
|
||||
execsql {
|
||||
SELECT b FROM t2 ORDER BY b;
|
||||
}
|
||||
} {BCDE bcd ABCD abc}
|
||||
do_test reindex-2.3 {
|
||||
execsql {
|
||||
SELECT c FROM t2 ORDER BY c;
|
||||
}
|
||||
} {abc ABCD bcd BCDE}
|
||||
do_test reindex-2.4 {
|
||||
execsql {
|
||||
SELECT d FROM t2 ORDER BY d;
|
||||
}
|
||||
} {ABCD BCDE abc bcd}
|
||||
|
||||
# Change a collating sequence function. Verify that REINDEX rebuilds
|
||||
# the index.
|
||||
#
|
||||
do_test reindex-2.5 {
|
||||
proc c1 {a b} {
|
||||
return [string compare $a $b]
|
||||
}
|
||||
execsql {
|
||||
SELECT a FROM t2 ORDER BY a;
|
||||
}
|
||||
} {bcd abc BCDE ABCD}
|
||||
ifcapable {integrityck} {
|
||||
do_test reindex-2.5.1 {
|
||||
string equal ok [execsql {PRAGMA integrity_check}]
|
||||
} {0}
|
||||
}
|
||||
do_test reindex-2.6 {
|
||||
execsql {
|
||||
REINDEX c2;
|
||||
SELECT a FROM t2 ORDER BY a;
|
||||
}
|
||||
} {bcd abc BCDE ABCD}
|
||||
do_test reindex-2.7 {
|
||||
execsql {
|
||||
REINDEX t1;
|
||||
SELECT a FROM t2 ORDER BY a;
|
||||
}
|
||||
} {bcd abc BCDE ABCD}
|
||||
do_test reindex-2.8 {
|
||||
execsql {
|
||||
REINDEX c1;
|
||||
SELECT a FROM t2 ORDER BY a;
|
||||
}
|
||||
} {ABCD BCDE abc bcd}
|
||||
integrity_check reindex-2.8.1
|
||||
|
||||
finish_test
|
||||
|
||||
Reference in New Issue
Block a user