diff options
author | drh <> | 2021-04-22 18:02:48 +0000 |
---|---|---|
committer | drh <> | 2021-04-22 18:02:48 +0000 |
commit | 3d8c92d041b380f66dc753ee38aaeb3b87d559cb (patch) | |
tree | ab4368a14a000ad98f27b6cb190cac54eee0c566 /src | |
parent | a5b51b8715412c129eb243869063c87d95490956 (diff) | |
download | sqlite-3d8c92d041b380f66dc753ee38aaeb3b87d559cb.tar.gz sqlite-3d8c92d041b380f66dc753ee38aaeb3b87d559cb.zip |
Raise an error on an attempt to rename an eponymous virtual table.
FossilOrigin-Name: c7909e8e0d0577c6109f13c0b14fb565239aae8af8963d659f363e124f3437fc
Diffstat (limited to 'src')
-rw-r--r-- | src/alter.c | 6 | ||||
-rw-r--r-- | src/sqliteInt.h | 1 | ||||
-rw-r--r-- | src/vtab.c | 1 |
3 files changed, 5 insertions, 3 deletions
diff --git a/src/alter.c b/src/alter.c index d3fe6bf2e..32a472943 100644 --- a/src/alter.c +++ b/src/alter.c @@ -29,8 +29,9 @@ ** Or, if zName is not a system table, zero is returned. */ static int isAlterableTable(Parse *pParse, Table *pTab){ - if( 0==sqlite3StrNICmp(pTab->zName, "sqlite_", 7) + if( 0==sqlite3StrNICmp(pTab->zName, "sqlite_", 7) #ifndef SQLITE_OMIT_VIRTUALTABLE + || (pTab->tabFlags & TF_Eponymous)!=0 || ( (pTab->tabFlags & TF_Shadow)!=0 && sqlite3ReadOnlyShadowTables(pParse->db) ) @@ -918,8 +919,7 @@ static RenameToken *renameTokenFind( void *pPtr ){ RenameToken **pp; - if( pPtr==0 ){ - assert( pParse->nErr || pParse->db->mallocFailed ); + if( NEVER(pPtr==0) ){ return 0; } for(pp=&pParse->pRename; (*pp); pp=&(*pp)->pNext){ diff --git a/src/sqliteInt.h b/src/sqliteInt.h index 21c6f6f30..b8b6b340d 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -2236,6 +2236,7 @@ struct Table { #define TF_Shadow 0x1000 /* True for a shadow table */ #define TF_HasStat4 0x2000 /* STAT4 info available for this table */ #define TF_Ephemeral 0x4000 /* An ephemeral table */ +#define TF_Eponymous 0x8000 /* An eponymous virtual table */ /* ** Test to see whether or not a table is a virtual table. This is diff --git a/src/vtab.c b/src/vtab.c index ded12c13b..c9dcadae4 100644 --- a/src/vtab.c +++ b/src/vtab.c @@ -1221,6 +1221,7 @@ int sqlite3VtabEponymousTableInit(Parse *pParse, Module *pMod){ pTab->pSchema = db->aDb[0].pSchema; assert( pTab->nModuleArg==0 ); pTab->iPKey = -1; + pTab->tabFlags |= TF_Eponymous; addModuleArgument(pParse, pTab, sqlite3DbStrDup(db, pTab->zName)); addModuleArgument(pParse, pTab, 0); addModuleArgument(pParse, pTab, sqlite3DbStrDup(db, pTab->zName)); |