]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Make sure indices in ATTACH-ed databases are put into the right hash table.
authordrh <drh@noemail.net>
Tue, 1 Jul 2003 18:13:14 +0000 (18:13 +0000)
committerdrh <drh@noemail.net>
Tue, 1 Jul 2003 18:13:14 +0000 (18:13 +0000)
Ticket #354. (CVS 1044)

FossilOrigin-Name: eb4582831d536cd26a1738f9ad197e40486d0958

manifest
manifest.uuid
src/build.c
test/attach2.test [new file with mode: 0644]

index 3601d13749b9a78948249d5efc41dd6f3ce2f8b7..f86502eff0b9f8c98c80b4cac75f7f3e9ee782d7 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Update\sthe\snull-handling\sdocument\sto\sshow\show\sSQL\sAnywhere\sand\sBorland\nInterbase\sdeal\swith\sNULLs.\s(CVS\s1043)
-D 2003-07-01T01:16:30
+C Make\ssure\sindices\sin\sATTACH-ed\sdatabases\sare\sput\sinto\sthe\sright\shash\stable.\nTicket\s#354.\s(CVS\s1044)
+D 2003-07-01T18:13:15
 F Makefile.in 9ad23ed4ca97f9670c4496432e3fbd4b3760ebde
 F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
 F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
@@ -24,7 +24,7 @@ F src/auth.c c8f50d4507e37779d96ff3c55417bc2b612dfed6
 F src/btree.c ba1cc0c71c3d2742b9a9047832335dc7d3656c45
 F src/btree.h 9b7c09f1e64274d7bb74a57bbfc63778f67b1048
 F src/btree_rb.c f30f5cddc4375c05bf361116da1492d9601760ca
-F src/build.c 936d10b33b326546280690bee7f20efaf19a6fe8
+F src/build.c 13b6ae48ce71a0f59368f548dba2a662375aeaf6
 F src/copy.c 9e47975ea96751c658bcf1a0c4f0bb7c6ee61e73
 F src/delete.c 0f81e6799c089487615d38e042a2de4d2d6192bc
 F src/encode.c 25ea901a9cefb3d93774afa4a06b57cb58acf544
@@ -64,6 +64,7 @@ F src/vdbe.h 985c24f312d10f9ef8f9a8b8ea62fcdf68e82f21
 F src/where.c 1e645d430cb4b347159c28c6085e9801160f2099
 F test/all.test 569a92a8ee88f5300c057cc4a8f50fbbc69a3242
 F test/attach.test eccea2937923ac0be8ad1072585fd3b4f0b85598
+F test/attach2.test d69003d59f5b1260dfcf3fcc5f60f164680aa7ee
 F test/auth.test a618f0e96bb5baa7a5623eb939388e9ac5f5d9a2
 F test/bigfile.test 1cd8256d4619c39bea48147d344f348823e78678
 F test/bigrow.test 8ab252dba108f12ad64e337b0f2ff31a807ac578
@@ -167,7 +168,7 @@ F www/speed.tcl 2f6b1155b99d39adb185f900456d1d592c4832b3
 F www/sqlite.tcl 3c83b08cf9f18aa2d69453ff441a36c40e431604
 F www/tclsqlite.tcl 1db15abeb446aad0caf0b95b8b9579720e4ea331
 F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1
-P a3920b0804e9993bb21e6c46c612e72bd03178a2
-R a8b083bb866a87dcf70f77ed1fb561d9
+P 9a87f2f326d7fc8bb9f832d0e3fd31141e14e08f
+R 690d67d55b36d46742737ebfcab1300e
 U drh
-Z 3174cbe95c851c7270578015eafa897d
+Z bb2529e86a37931176f7781f5edf39cb
index 117d1618f95d0661c8ec6ae93036adc743a3caa6..e2376bf7ba9ed08e6d9dfa52cdf43e76ad3165f6 100644 (file)
@@ -1 +1 @@
-9a87f2f326d7fc8bb9f832d0e3fd31141e14e08f
\ No newline at end of file
+eb4582831d536cd26a1738f9ad197e40486d0958
\ No newline at end of file
index 36d083fc38d1b6d30e94c06d865f8b3bd48978ec..f92369f23be4882e950baa52beb1287fd1a447b3 100644 (file)
@@ -23,7 +23,7 @@
 **     ROLLBACK
 **     PRAGMA
 **
-** $Id: build.c,v 1.155 2003/05/31 16:21:12 drh Exp $
+** $Id: build.c,v 1.156 2003/07/01 18:13:15 drh Exp $
 */
 #include "sqliteInt.h"
 #include <ctype.h>
@@ -1693,8 +1693,8 @@ void sqliteCreateIndex(
   */
   if( !pParse->explain ){
     Index *p;
-    p = sqliteHashInsert(&db->aDb[isTemp].idxHash, 
-                         pIndex->zName, strlen(zName)+1, pIndex);
+    p = sqliteHashInsert(&db->aDb[pIndex->iDb].idxHash, 
+                         pIndex->zName, strlen(pIndex->zName)+1, pIndex);
     if( p ){
       assert( p==pIndex );  /* Malloc must have failed */
       sqliteFree(pIndex);
diff --git a/test/attach2.test b/test/attach2.test
new file mode 100644 (file)
index 0000000..e6020b3
--- /dev/null
@@ -0,0 +1,46 @@
+# 2003 July 1
+#
+# The author disclaims copyright to this source code.  In place of
+# a legal notice, here is a blessing:
+#
+#    May you do good and not evil.
+#    May you find forgiveness for yourself and forgive others.
+#    May you share freely, never taking more than you give.
+#
+#***********************************************************************
+# This file implements regression tests for SQLite library.  The
+# focus of this script is testing the ATTACH and DETACH commands
+# and related functionality.
+#
+# $Id: attach2.test,v 1.1 2003/07/01 18:13:16 drh Exp $
+#
+
+
+set testdir [file dirname $argv0]
+source $testdir/tester.tcl
+
+# Ticket #354
+#
+do_test attach2-1.1 {
+  db eval {
+    CREATE TABLE t1(a,b);
+    CREATE INDEX x1 ON t1(a);
+  }
+  file delete -force test2.db
+  sqlite db2 test2.db
+  db2 eval {
+    CREATE TABLE t1(a,b);
+    CREATE INDEX x1 ON t1(a);
+  }
+  catchsql {
+    ATTACH 'test2.db' AS t2;
+  }
+} {0 {}}
+
+for {set i 2} {$i<=15} {incr i} {
+  catch {db$i close}
+}
+file delete -force test2.db
+
+
+finish_test