1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-12 13:01:09 +03:00

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
This commit is contained in:
drh
2018-11-06 14:03:07 +00:00
parent 5a65470300
commit fc25721c9e
11 changed files with 25 additions and 43 deletions

View File

@@ -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;