diff options
author | dan <Dan Kennedy> | 2024-06-05 11:36:58 +0000 |
---|---|---|
committer | dan <Dan Kennedy> | 2024-06-05 11:36:58 +0000 |
commit | e3eefe00dd907271a8d845b8e1565d5580d78364 (patch) | |
tree | 88f7bb48979ba9cb5c3cfe7ea9f3b3103f67751d /src/resolve.c | |
parent | ecaa021759d5b581b62ae705c5a6617661aa14d1 (diff) | |
download | sqlite-e3eefe00dd907271a8d845b8e1565d5580d78364.tar.gz sqlite-e3eefe00dd907271a8d845b8e1565d5580d78364.zip |
Fix a very obscure issue where the name resolver could get confused if aliases like "sqlite_schema" or "sqlite_master" were used in a query involving the sqlite_temp_schema table.
FossilOrigin-Name: a096eb7554952f8137c6e9330c328164719fb27e958787fbd503bcd1364e6ae4
Diffstat (limited to 'src/resolve.c')
-rw-r--r-- | src/resolve.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/resolve.c b/src/resolve.c index bf8326aa6..40044a220 100644 --- a/src/resolve.c +++ b/src/resolve.c @@ -228,7 +228,7 @@ static void extendFJMatch( static SQLITE_NOINLINE int isValidSchemaTableName( const char *zTab, /* Name as it appears in the SQL */ Table *pTab, /* The schema table we are trying to match */ - Schema *pSchema /* non-NULL if a database qualifier is present */ + const char *zDb /* non-NULL if a database qualifier is present */ ){ const char *zLegacy; assert( pTab!=0 ); @@ -239,7 +239,7 @@ static SQLITE_NOINLINE int isValidSchemaTableName( if( sqlite3StrICmp(zTab+7, &PREFERRED_TEMP_SCHEMA_TABLE[7])==0 ){ return 1; } - if( pSchema==0 ) return 0; + if( zDb==0 ) return 0; if( sqlite3StrICmp(zTab+7, &LEGACY_SCHEMA_TABLE[7])==0 ) return 1; if( sqlite3StrICmp(zTab+7, &PREFERRED_SCHEMA_TABLE[7])==0 ) return 1; }else{ @@ -422,7 +422,7 @@ static int lookupName( } }else if( sqlite3StrICmp(zTab, pTab->zName)!=0 ){ if( pTab->tnum!=1 ) continue; - if( !isValidSchemaTableName(zTab, pTab, pSchema) ) continue; + if( !isValidSchemaTableName(zTab, pTab, zDb) ) continue; } assert( ExprUseYTab(pExpr) ); if( IN_RENAME_OBJECT && pItem->zAlias ){ |