mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-07 02:42:48 +03:00
Ignore the database name on the target table when parsing a CREATE TABLE
statement out of the sqlite_master table. This is a fix for ticket [d6ddba6706353] that preserves backwards compatibility. FossilOrigin-Name: 009c96ea7836edf75d65b150055e920079bb45e3
This commit is contained in:
@@ -117,15 +117,28 @@ void sqlite3BeginTrigger(
|
||||
goto trigger_cleanup;
|
||||
}
|
||||
}
|
||||
if( !pTableName || db->mallocFailed ){
|
||||
goto trigger_cleanup;
|
||||
}
|
||||
|
||||
/* A long-standing parser bug is that this syntax was allowed:
|
||||
**
|
||||
** CREATE TRIGGER attached.demo AFTER INSERT ON attached.tab ....
|
||||
** ^^^^^^^^
|
||||
**
|
||||
** To maintain backwards compatibility, ignore the database
|
||||
** name on pTableName if we are reparsing our of SQLITE_MASTER.
|
||||
*/
|
||||
if( db->init.busy && iDb!=1 ){
|
||||
sqlite3DbFree(db, pTableName->a[0].zDatabase);
|
||||
pTableName->a[0].zDatabase = 0;
|
||||
}
|
||||
|
||||
/* If the trigger name was unqualified, and the table is a temp table,
|
||||
** then set iDb to 1 to create the trigger in the temporary database.
|
||||
** If sqlite3SrcListLookup() returns 0, indicating the table does not
|
||||
** exist, the error is caught by the block below.
|
||||
*/
|
||||
if( !pTableName || db->mallocFailed ){
|
||||
goto trigger_cleanup;
|
||||
}
|
||||
pTab = sqlite3SrcListLookup(pParse, pTableName);
|
||||
if( db->init.busy==0 && pName2->n==0 && pTab
|
||||
&& pTab->pSchema==db->aDb[1].pSchema ){
|
||||
|
Reference in New Issue
Block a user