diff options
author | drh <drh@noemail.net> | 2018-11-06 14:03:07 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2018-11-06 14:03:07 +0000 |
commit | fc25721c9e044a23b2a4ab904c68bbbe338d8165 (patch) | |
tree | 71cc4c91b9cc9c71756582ced2e6282d2339ea31 /src | |
parent | 5a65470300814c4f26c4952487385e33e5f286c2 (diff) | |
download | sqlite-fc25721c9e044a23b2a4ab904c68bbbe338d8165.tar.gz sqlite-fc25721c9e044a23b2a4ab904c68bbbe338d8165.zip |
Only allow shadow table to be written from within a recursive SQL call.
Omit the SQLITE_PREPARE_SHADOW flag. Some tests are failing because the
tests depend on being able to write to shadow tables.
FossilOrigin-Name: d890c6582524677666e6f5b5817331dec332ade16b2f744cbb8a3c7dd9b63e21
Diffstat (limited to 'src')
-rw-r--r-- | src/delete.c | 7 | ||||
-rw-r--r-- | src/prepare.c | 3 | ||||
-rw-r--r-- | src/sqlite.h.in | 9 | ||||
-rw-r--r-- | src/sqliteInt.h | 1 |
4 files changed, 4 insertions, 16 deletions
diff --git a/src/delete.c b/src/delete.c index c015eb43e..932520382 100644 --- a/src/delete.c +++ b/src/delete.c @@ -57,8 +57,9 @@ int sqlite3IsReadOnly(Parse *pParse, Table *pTab, int viewOk){ ** 2) It is a system table (i.e. sqlite_master), this call is not ** part of a nested parse and writable_schema pragma has not ** been specified. - ** 3) The table is a shadow table and the SQLITE_PREPARE_SHADOW flag - ** is omitted. + ** 3) The table is a shadow table and the current sqlite3_prepare() + ** is for a top-level SQL statement, not a nested SQL statement + ** issued by a virtual table implementation. ** ** In either case leave an error message in pParse and return non-zero. */ @@ -68,7 +69,7 @@ int sqlite3IsReadOnly(Parse *pParse, Table *pTab, int viewOk){ && sqlite3WritableSchema(pParse->db)==0 && pParse->nested==0) || ( (pTab->tabFlags & TF_Shadow)!=0 - && pParse->writeShadow==0) + && pParse->db->nVdbeExec==0) ){ sqlite3ErrorMsg(pParse, "table %s may not be modified", pTab->zName); return 1; diff --git a/src/prepare.c b/src/prepare.c index a6accbc7d..4d33f0b1e 100644 --- a/src/prepare.c +++ b/src/prepare.c @@ -545,9 +545,6 @@ static int sqlite3Prepare( sParse.disableLookaside++; db->lookaside.bDisable++; } - if( prepFlags & SQLITE_PREPARE_SHADOW ){ - sParse.writeShadow = 1; - } /* Check to verify that it is possible to get a read lock on all ** database schemas. The inability to get a read lock indicates that diff --git a/src/sqlite.h.in b/src/sqlite.h.in index 02963f454..88476836c 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -3642,19 +3642,10 @@ int sqlite3_limit(sqlite3*, int id, int newVal); ** normalize a SQL statement are unspecified and subject to change. ** At a minimum, literal values will be replaced with suitable ** placeholders. -** -** [[SQLITE_PREPARE_SHADOW]] ^(<dt>SQLITE_PREPARE_SHADOW</dt> -** <dd>When the SQLITE_PREPARE_SHADOW flag is set, writes to shadow -** tables are allowed. Shadow tables are ordinary tables associated -** with some virtual tables that serve as the storage for the virtual -** table. Shadow tables are normally read-only. Virtual table -** implementations use this flag so that they can write to their own -** shadow tables. ** </dl> */ #define SQLITE_PREPARE_PERSISTENT 0x01 #define SQLITE_PREPARE_NORMALIZE 0x02 -#define SQLITE_PREPARE_SHADOW 0x04 /* ** CAPI3REF: Compiling An SQL Statement diff --git a/src/sqliteInt.h b/src/sqliteInt.h index 77f101183..053ac01dc 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -3086,7 +3086,6 @@ struct Parse { u8 eTriggerOp; /* TK_UPDATE, TK_INSERT or TK_DELETE */ u8 eOrconf; /* Default ON CONFLICT policy for trigger steps */ u8 disableTriggers; /* True to disable triggers */ - u8 writeShadow; /* True if shadow tables are writable */ /************************************************************************** ** Fields above must be initialized to zero. The fields that follow, |