Fix a problem with the way temporary tables mask permanent tables. (CVS 345)

FossilOrigin-Name: ba89da603135e5f63f6f97ba3adad02682375c07
This commit is contained in:
drh
2002-01-10 14:31:48 +00:00
parent be67d9cb4b
commit da9e034610
8 changed files with 142 additions and 54 deletions
+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]);
}