From: drh Date: Tue, 8 Sep 2015 20:26:09 +0000 (+0000) Subject: Eponymous virtual tables exist in the "main" schema only. Enforce this rule. X-Git-Tag: version-3.9.0~138 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b4d472f609d0f81bec921b82251f0a6c23a26ece;p=thirdparty%2Fsqlite.git Eponymous virtual tables exist in the "main" schema only. Enforce this rule. FossilOrigin-Name: 06f90bb274c4bb0c30585024c8d365d43c4162f2 --- diff --git a/manifest b/manifest index 72d1042163..a8b91dc375 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sthe\shelp\smessage\sthat\ssqlite3_analyzer.exe\sgenerates\sfor\sinvalid\narguments. -D 2015-09-08T17:31:30.826 +C Eponymous\svirtual\stables\sexist\sin\sthe\s"main"\sschema\sonly.\s\sEnforce\sthis\srule. +D 2015-09-08T20:26:09.245 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in f85066ce844a28b671aaeeff320921cd0ce36239 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -284,7 +284,7 @@ F src/btmutex.c 45a968cc85afed9b5e6cf55bf1f42f8d18107f79 F src/btree.c 4084d9eed2817331f6e6a82230ba30e448cad497 F src/btree.h 969adc948e89e449220ff0ff724c94bb2a52e9f1 F src/btreeInt.h 8177c9ab90d772d6d2c6c517e05bed774b7c92c0 -F src/build.c 5566b3410080a54e5c302c55d3de53fd080cfc7d +F src/build.c ba9e1529730407cdf491480745716d6fbdc28cd3 F src/callback.c 7b44ce59674338ad48b0e84e7b72f935ea4f68b0 F src/complete.c addcd8160b081131005d5bc2d34adf20c1c5c92f F src/ctime.c 5a0b735dc95604766f5dac73973658eef782ee8b @@ -1038,7 +1038,7 @@ F test/superlock.test 1cde669f68d2dd37d6c9bd35eee1d95491ae3fc2 F test/sync.test a34cd43e98b7fb84eabbf38f7ed8f7349b3f3d85 F test/syscall.test d2fdaad713f103ac611fe7ef9b724c7b69f8149c F test/sysfault.test fa776e60bf46bdd3ae69f0b73e46ee3977a58ae6 -F test/tabfunc01.test a12eba3f48a03a6626f985734ecc28132381fa9b +F test/tabfunc01.test fa9d8dfc75747019e0be98d3b6ac68d18632d328 F test/table.test 33bf0d1fd07f304582695184b8e6feb017303816 F test/tableapi.test 2674633fa95d80da917571ebdd759a14d9819126 F test/tableopts.test dba698ba97251017b7c80d738c198d39ab747930 @@ -1383,7 +1383,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 986677224a8da5e79fbbd90673f1b595da89c5d6 -R 53efe0392669648bee0c2878b1555bb5 +P 33a14e7be1004abca7a30f675459138d7f8d72b1 +R 1f56442884ee3ab877d3d3fe559d09f2 U drh -Z cf7dc4ba83b64f541e9e5f6eb6b8039d +Z b9e298f3b9bca3ea8a0b0e129438890a diff --git a/manifest.uuid b/manifest.uuid index 04b63a44c2..b04d06e2a5 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -33a14e7be1004abca7a30f675459138d7f8d72b1 \ No newline at end of file +06f90bb274c4bb0c30585024c8d365d43c4162f2 \ No newline at end of file diff --git a/src/build.c b/src/build.c index 51facddff2..98a032bd7c 100644 --- a/src/build.c +++ b/src/build.c @@ -357,12 +357,14 @@ Table *sqlite3LocateTable( if( p==0 ){ const char *zMsg = isView ? "no such view" : "no such table"; #ifndef SQLITE_OMIT_VIRTUALTABLE - /* If zName is the not the name of a table in the schema created using - ** CREATE, then check to see if it is the name of an virtual table that - ** can be an eponymous virtual table. */ - Module *pMod = (Module*)sqlite3HashFind(&pParse->db->aModule, zName); - if( pMod && sqlite3VtabEponymousTableInit(pParse, pMod) ){ - return pMod->pEpoTab; + if( sqlite3FindDbName(pParse->db, zDbase)<1 ){ + /* If zName is the not the name of a table in the schema created using + ** CREATE, then check to see if it is the name of an virtual table that + ** can be an eponymous virtual table. */ + Module *pMod = (Module*)sqlite3HashFind(&pParse->db->aModule, zName); + if( pMod && sqlite3VtabEponymousTableInit(pParse, pMod) ){ + return pMod->pEpoTab; + } } #endif if( zDbase ){ diff --git a/test/tabfunc01.test b/test/tabfunc01.test index 30a40e3138..07b3c80442 100644 --- a/test/tabfunc01.test +++ b/test/tabfunc01.test @@ -69,5 +69,18 @@ do_execsql_test tabfunc01-3.1 { SELECT DISTINCT value FROM generate_series(1,x), t1 ORDER BY 1; } {1 2 3} +# Eponymous virtual table exists in the "main" schema only +# +do_execsql_test tabfunc01-4.1 { + SELECT * FROM main.generate_series(1,4) +} {1 2 3 4} +do_catchsql_test tabfunc01-4.2 { + SELECT * FROM temp.generate_series(1,4) +} {1 {no such table: temp.generate_series}} +do_catchsql_test tabfunc01-4.3 { + ATTACH ':memory:' AS aux1; + CREATE TABLE aux1.t1(a,b,c); + SELECT * FROM aux1.generate_series(1,4) +} {1 {no such table: aux1.generate_series}} finish_test