Make sure indices in ATTACH-ed databases are put into the right hash table.

Ticket #354. (CVS 1044)

FossilOrigin-Name: eb4582831d536cd26a1738f9ad197e40486d0958
This commit is contained in:
drh 2003-07-01 18:13:14 +00:00
parent c5aceb33cb
commit 3c8bf55a04
4 changed files with 57 additions and 10 deletions

View File

@ -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

View File

@ -1 +1 @@
9a87f2f326d7fc8bb9f832d0e3fd31141e14e08f
eb4582831d536cd26a1738f9ad197e40486d0958

View 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);

46
test/attach2.test Normal file
View File

@ -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