Modify the SQLITE_DBCONFIG_ENABLE_VIEW option so that it always permits

TEMP views, just as SQLITE_DBCONFIG_ENABLE_TRIGGER always permits TEMP
triggers.

FossilOrigin-Name: 83dab8b358b6832a221a58e74dd5e99b9cdea4eee65124bb6799881e867d989c
This commit is contained in:
drh 2021-03-05 18:33:01 +00:00
parent 68d4f07577
commit 70149ba47e
5 changed files with 27 additions and 14 deletions

View File

@ -1,5 +1,5 @@
C Fix\sproblems\swith\sRETURNING\sclauses\sattached\sto\sUPDATEs\son\stables\swith\svirtual\scolumns. C Modify\sthe\sSQLITE_DBCONFIG_ENABLE_VIEW\soption\sso\sthat\sit\salways\spermits\nTEMP\sviews,\sjust\sas\sSQLITE_DBCONFIG_ENABLE_TRIGGER\salways\spermits\sTEMP\ntriggers.
D 2021-03-05T15:42:15.578 D 2021-03-05T18:33:01.185
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -542,9 +542,9 @@ F src/printf.c 2b03a80d7c11bb422115dca175a18bf430e9c9dbaa0eee63b758f0c022f8f34f
F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384 F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384
F src/resolve.c 688070848f0a0c41bcc545a4b4b052921d9abc29ba3102985d3d6f7595d9637c F src/resolve.c 688070848f0a0c41bcc545a4b4b052921d9abc29ba3102985d3d6f7595d9637c
F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92 F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92
F src/select.c 297724a06fb8ecfcebae72f80c4d0f579bd28d428e011a61a75be366da644323 F src/select.c fb1851222c3ec1e0e1b4c8197a76a4595008956220ddebd7a0a898ad15705acc
F src/shell.c.in af18a2e980aabe739a8188266464866fe7947b100674e07480e7ba3e37595947 F src/shell.c.in af18a2e980aabe739a8188266464866fe7947b100674e07480e7ba3e37595947
F src/sqlite.h.in 8855a19f37ade8dad189a9e48233a2ebe1b46faf469c7eb0906a654e252dcc57 F src/sqlite.h.in 3426a080ea1f222a73e3bd91e7eacbd30570a0117c03d42c6dde606f33e5e318
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F src/sqlite3ext.h 61b38c073d5e1e96a3d45271b257aef27d0d13da2bea5347692ae579475cd95e F src/sqlite3ext.h 61b38c073d5e1e96a3d45271b257aef27d0d13da2bea5347692ae579475cd95e
F src/sqliteInt.h 7c4679b3b068149f497fe50203a4b04be6b17b8aba581cdbc75da45329cad915 F src/sqliteInt.h 7c4679b3b068149f497fe50203a4b04be6b17b8aba581cdbc75da45329cad915
@ -1676,7 +1676,7 @@ F test/vacuum6.test d3173a54edc81d13d99e4cf4972232b3cbb52f1d56ed48c3a939ef4e751c
F test/vacuummem.test 7b42abb3208bd82dd23a7536588396f295a314f2 F test/vacuummem.test 7b42abb3208bd82dd23a7536588396f295a314f2
F test/varint.test bbce22cda8fc4d135bcc2b589574be8410614e62 F test/varint.test bbce22cda8fc4d135bcc2b589574be8410614e62
F test/veryquick.test 57ab846bacf7b90cf4e9a672721ea5c5b669b661 F test/veryquick.test 57ab846bacf7b90cf4e9a672721ea5c5b669b661
F test/view.test fd48eddb32a35a98c3de70062ebac66ebf4a2bbfc75a1cc1109159ef8bfc47a9 F test/view.test ea88361d5e9bc8eabf9f573185a16aea73a885be9b6c6a95ae84908913416a80
F test/vtab1.test c5d9e90ed02bcacd776dcbb7360199d290f7f53c26b484ddece543060c54319f F test/vtab1.test c5d9e90ed02bcacd776dcbb7360199d290f7f53c26b484ddece543060c54319f
F test/vtab2.test 14d4ab26cee13ba6cf5c5601b158e4f57552d3b055cdd9406cf7f711e9c84082 F test/vtab2.test 14d4ab26cee13ba6cf5c5601b158e4f57552d3b055cdd9406cf7f711e9c84082
F test/vtab3.test b45f47d20f225ccc9c28dc915d92740c2dee311e F test/vtab3.test b45f47d20f225ccc9c28dc915d92740c2dee311e
@ -1909,8 +1909,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P 90c6b9fcb0e15e2552fe5be53f8201f145bb535cc37b603d488eadf33438412b f0ef5c76ab1a6568b9148b928277bf589d4cb7033c0acf3e6323879b656d8bd1 P 6b41b136fbfc0b56a6948f2306b69fb1d69306adb86674a15a87fe3b52062512
R 9ce22f2ca863b622fffd6e204bd49f1c R 2b8fdfb64aa0287e9dad9e4deafc2264
T +closed f0ef5c76ab1a6568b9148b928277bf589d4cb7033c0acf3e6323879b656d8bd1 U drh
U dan Z 2672fe284ccfad8e2f3910b2a1b2092c
Z 42641730ad48d1c5662411b50a4ba2b2

View File

@ -1 +1 @@
6b41b136fbfc0b56a6948f2306b69fb1d69306adb86674a15a87fe3b52062512 83dab8b358b6832a221a58e74dd5e99b9cdea4eee65124bb6799881e867d989c

View File

@ -5254,7 +5254,10 @@ static int selectExpander(Walker *pWalker, Select *p){
u8 eCodeOrig = pWalker->eCode; u8 eCodeOrig = pWalker->eCode;
if( sqlite3ViewGetColumnNames(pParse, pTab) ) return WRC_Abort; if( sqlite3ViewGetColumnNames(pParse, pTab) ) return WRC_Abort;
assert( pFrom->pSelect==0 ); assert( pFrom->pSelect==0 );
if( pTab->pSelect && (db->flags & SQLITE_EnableView)==0 ){ if( pTab->pSelect
&& (db->flags & SQLITE_EnableView)==0
&& pTab->pSchema!=db->aDb[1].pSchema
){
sqlite3ErrorMsg(pParse, "access to view \"%s\" prohibited", sqlite3ErrorMsg(pParse, "access to view \"%s\" prohibited",
pTab->zName); pTab->zName);
} }

View File

@ -2132,7 +2132,13 @@ struct sqlite3_mem_methods {
** The second parameter is a pointer to an integer into which ** The second parameter is a pointer to an integer into which
** is written 0 or 1 to indicate whether views are disabled or enabled ** is written 0 or 1 to indicate whether views are disabled or enabled
** following this call. The second parameter may be a NULL pointer, in ** following this call. The second parameter may be a NULL pointer, in
** which case the view setting is not reported back. </dd> ** which case the view setting is not reported back.
**
** <p>Originally this option disabled all views. ^(However, since
** SQLite version 3.35.0, TEMP views are still allowed even if
** this option is off. So, in other words, this option now only disables
** views in the main database schema or in the schemas of ATTACH-ed
** databases.)^ </dd>
** **
** [[SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER]] ** [[SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER]]
** <dt>SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER</dt> ** <dt>SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER</dt>

View File

@ -44,12 +44,17 @@ do_test view-1.1.100 {
SELECT * FROM v1 ORDER BY a; SELECT * FROM v1 ORDER BY a;
} }
} {1 {access to view "v1" prohibited}} } {1 {access to view "v1" prohibited}}
do_execsql_test view-1.1.101 {
CREATE TEMP VIEW v1temp AS SELECT a, b FROM t1;
SELECT * FROM v1temp ORDER BY a;
} {1 2 4 5 7 8}
do_test view-1.1.110 { do_test view-1.1.110 {
db config enable_view on db config enable_view on
catchsql { catchsql {
SELECT * FROM v1 ORDER BY a; SELECT * FROM v1 ORDER BY a;
SELECT * FROM v1temp ORDER BY a;
} }
} {0 {1 2 4 5 7 8}} } {0 {1 2 4 5 7 8 1 2 4 5 7 8}}
do_test view-1.2 { do_test view-1.2 {
catchsql { catchsql {
ROLLBACK; ROLLBACK;