/ Check-in [eb458283]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Make sure indices in ATTACH-ed databases are put into the right hash table. Ticket #354. (CVS 1044)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: eb4582831d536cd26a1738f9ad197e40486d0958
User & Date: drh 2003-07-01 18:13:15
Context
2003-07-06
17:22
Correctly handle comparing an INTEGER PRIMARY KEY against a floating point number. Ticket #377. (CVS 1045) check-in: 982aa335 user: drh tags: trunk
2003-07-01
18:13
Make sure indices in ATTACH-ed databases are put into the right hash table. Ticket #354. (CVS 1044) check-in: eb458283 user: drh tags: trunk
01:16
Update the null-handling document to show how SQL Anywhere and Borland Interbase deal with NULLs. (CVS 1043) check-in: 9a87f2f3 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/build.c.

    19     19   **     DROP INDEX
    20     20   **     creating ID lists
    21     21   **     BEGIN TRANSACTION
    22     22   **     COMMIT
    23     23   **     ROLLBACK
    24     24   **     PRAGMA
    25     25   **
    26         -** $Id: build.c,v 1.155 2003/05/31 16:21:12 drh Exp $
           26  +** $Id: build.c,v 1.156 2003/07/01 18:13:15 drh Exp $
    27     27   */
    28     28   #include "sqliteInt.h"
    29     29   #include <ctype.h>
    30     30   
    31     31   /*
    32     32   ** This routine is called when a new SQL statement is beginning to
    33     33   ** be parsed.  Check to see if the schema for the database needs
................................................................................
  1689   1689     }
  1690   1690   
  1691   1691     /* Link the new Index structure to its table and to the other
  1692   1692     ** in-memory database structures. 
  1693   1693     */
  1694   1694     if( !pParse->explain ){
  1695   1695       Index *p;
  1696         -    p = sqliteHashInsert(&db->aDb[isTemp].idxHash, 
  1697         -                         pIndex->zName, strlen(zName)+1, pIndex);
         1696  +    p = sqliteHashInsert(&db->aDb[pIndex->iDb].idxHash, 
         1697  +                         pIndex->zName, strlen(pIndex->zName)+1, pIndex);
  1698   1698       if( p ){
  1699   1699         assert( p==pIndex );  /* Malloc must have failed */
  1700   1700         sqliteFree(pIndex);
  1701   1701         goto exit_create_index;
  1702   1702       }
  1703   1703       db->flags |= SQLITE_InternChanges;
  1704   1704     }

Added test/attach2.test.

            1  +# 2003 July 1
            2  +#
            3  +# The author disclaims copyright to this source code.  In place of
            4  +# a legal notice, here is a blessing:
            5  +#
            6  +#    May you do good and not evil.
            7  +#    May you find forgiveness for yourself and forgive others.
            8  +#    May you share freely, never taking more than you give.
            9  +#
           10  +#***********************************************************************
           11  +# This file implements regression tests for SQLite library.  The
           12  +# focus of this script is testing the ATTACH and DETACH commands
           13  +# and related functionality.
           14  +#
           15  +# $Id: attach2.test,v 1.1 2003/07/01 18:13:16 drh Exp $
           16  +#
           17  +
           18  +
           19  +set testdir [file dirname $argv0]
           20  +source $testdir/tester.tcl
           21  +
           22  +# Ticket #354
           23  +#
           24  +do_test attach2-1.1 {
           25  +  db eval {
           26  +    CREATE TABLE t1(a,b);
           27  +    CREATE INDEX x1 ON t1(a);
           28  +  }
           29  +  file delete -force test2.db
           30  +  sqlite db2 test2.db
           31  +  db2 eval {
           32  +    CREATE TABLE t1(a,b);
           33  +    CREATE INDEX x1 ON t1(a);
           34  +  }
           35  +  catchsql {
           36  +    ATTACH 'test2.db' AS t2;
           37  +  }
           38  +} {0 {}}
           39  +
           40  +for {set i 2} {$i<=15} {incr i} {
           41  +  catch {db$i close}
           42  +}
           43  +file delete -force test2.db
           44  +
           45  +
           46  +finish_test