-C Remove\stwo\sincorrect\sassert()\sstatements\sadded\sby\sa\scheck-in\sfrom\searlier\ntoday.
-D 2021-11-03T16:35:23.811
+C First\sthe\sshadow\stable\smechanism\sso\sthat\sit\sworks\seven\sif\sthe\sshadow\stable\ncomes\sbefore\sthe\svirtual\stable\sin\sthe\ssqlite_schema\stable,\sas\scan\shappen\nafter\sa\sVACUUM.
+D 2021-11-04T00:51:53.284
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
F src/btree.c 2c8a52a7fd84b1aec4a79e7861b6368aecbf011a43247cc7d9a2946c7f0ae5ea
F src/btree.h 74d64b8f28cfa4a894d14d4ed64fa432cd697b98b61708d4351482ae15913e22
F src/btreeInt.h ee9348c4cb9077243b049edc93a82c1f32ca48baeabf2140d41362b9f9139ff7
-F src/build.c 8bdda90f9b1189c7b0813575171b3c6b2d74b3ade57c11cb4383776781ea9335
+F src/build.c 967d3ab8940879ed58f4fa1a50adcab8ce38d92abfd96ae31bee5e50adef5c19
F src/callback.c 106b585da1edd57d75fa579d823a5218e0bf37f191dbf7417eeb4a8a9a267dbc
F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e
F src/ctime.c 8159d5f706551861c18ec6c8f6bdf105e15ea00367f05d9ab65d31a1077facc1
F src/sqlite.h.in 99786216caf1c57aa3d70f95a7f84566dff6a9eeb50174799ea3b387eafd2a22
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F src/sqlite3ext.h d8f6f67ae9ad990a70dd03c093bcdc8883e159ff4bfd16a496f8fb80c6840b5a
-F src/sqliteInt.h 1af24220f40265a8fc164cd1bc4cfbec33550d4be205510d71a48b7198aed0e3
+F src/sqliteInt.h 26c7c88de66fb2259f309dd487fa2ececde6173b365348fa213e189136e950f7
F src/sqliteLimit.h d7323ffea5208c6af2734574bae933ca8ed2ab728083caa117c9738581a31657
F src/status.c 4b8bc2a6905163a38b739854a35b826c737333fab5b1f8e03fa7eb9a4799c4c1
F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1
F src/vdbesort.c 513b481c8bab4a6578c92194a60cf3bc3b48736e4a53f8d2d7918121c5b594e7
F src/vdbetrace.c fe0bc29ebd4e02c8bc5c1945f1d2e6be5927ec12c06d89b03ef2a4def34bf823
F src/vdbevtab.c f99b275366c5fc5e2d99f734729880994ab9500bdafde7fae3b02d562b9d323c
-F src/vtab.c d07cc24dd84b0b51bf05adb187b0d2e6b0cac56cfbc0197995a26d4f8fa5c7e2
+F src/vtab.c a380a5eed772917dec6b2e8a771c8b3f582424294316c6392fdf1ed68c7e6d84
F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9
F src/wal.c 6ae14d4797f31c67fc2be659d24fbc6e1a6f5f423bdfb5ef831ea171bce42320
F src/wal.h c3aa7825bfa2fe0d85bef2db94655f99870a285778baa36307c0a16da32b226a
F test/altermalloc2.test ca3ebc01670d9313953a2b7628d8cc00dc5ea9988f229b3cbbbe1cca506dae45
F test/altermalloc3.test 4660ac6240a8c82ba3947b927612dcc7c05a8eec3fe3c9f38e047ca69a789a33
F test/alterqf.test 6b2482a957692606b23567ebd2cf80eb773e3c826086f5f151eee9c5a962623d
-F test/altertab.test a13e11cb1933575002367613b1094f0eeb31f493e4bd9ebeca73279fe00c85e7
+F test/altertab.test 7273b8506eab46342be016af78028df49f3bd99037412f997a8f1011b37a6912
F test/altertab2.test b0d62f323ca5dab42b0bc028c52e310ebdd13e655e8fac070fe622bad7852c2b
F test/altertab3.test 5929f522fd6fd708396ad9f317d4af9ff1a93e460df85bb1d54d4499eeb94960
F test/amatch1.test b5ae7065f042b7f4c1c922933f4700add50cdb9f
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P b007a39dd3a46d13fe06f2a1eeb4e3fd4cad1a77892be6d175b31db1edd6f6a8
-R 336f4dbfa0d3239ff6d22097056aa24f
+P 3206edff947b9edb485466f05b2baadf725d798229630c7e83e88c0b9ae278ca
+R 8f5be0e60c11f630170e85314040c5d7
U drh
-Z da24b11e81afda71f53eb048fa69e639
+Z adc67823b696bff12115917b3784aff0
-3206edff947b9edb485466f05b2baadf725d798229630c7e83e88c0b9ae278ca
\ No newline at end of file
+005a8642773556825fe4c5d0b2c12517d35289308a30df0151ef7f080acb0172
\ No newline at end of file
}
#endif /* ifndef SQLITE_OMIT_VIRTUALTABLE */
+#ifndef SQLITE_OMIT_VIRTUALTABLE
+/*
+** Table pTab is a virtual table. If it the virtual table implementation
+** exists and has an xShadowName method, then loop over all other ordinary
+** tables within the same schema looking for shadow tables of pTab, and mark
+** any shadow tables seen using the TF_Shadow flag.
+*/
+void sqlite3MarkAllShadowTablesOf(sqlite3 *db, Table *pTab){
+ int nName; /* Length of pTab->zName */
+ Module *pMod; /* Module for the virtual table */
+ HashElem *k; /* For looping through the symbol table */
+
+ assert( IsVirtual(pTab) );
+ pMod = (Module*)sqlite3HashFind(&db->aModule, pTab->u.vtab.azArg[0]);
+ if( pMod==0 ) return;
+ if( NEVER(pMod->pModule==0) ) return;
+ if( pMod->pModule->xShadowName==0 ) return;
+ assert( pTab->zName!=0 );
+ nName = sqlite3Strlen30(pTab->zName);
+ for(k=sqliteHashFirst(&pTab->pSchema->tblHash); k; k=sqliteHashNext(k)){
+ Table *pOther = sqliteHashData(k);
+ assert( pOther->zName!=0 );
+ if( !IsOrdinaryTable(pOther) ) continue;
+ if( pOther->tabFlags & TF_Shadow ) continue;
+ if( sqlite3StrNICmp(pOther->zName, pTab->zName, nName)==0
+ && pOther->zName[nName]=='_'
+ && pMod->pModule->xShadowName(pOther->zName+nName+1)
+ ){
+ pOther->tabFlags |= TF_Shadow;
+ }
+ }
+}
+#endif /* ifndef SQLITE_OMIT_VIRTUALTABLE */
+
#ifndef SQLITE_OMIT_VIRTUALTABLE
/*
** Return true if zName is a shadow table name in the current database
assert( pTable );
#ifndef SQLITE_OMIT_VIRTUALTABLE
- db->nSchemaLock++;
- rc = sqlite3VtabCallConnect(pParse, pTable);
- db->nSchemaLock--;
- if( rc ){
- return 1;
+ if( IsVirtual(pTable) ){
+ db->nSchemaLock++;
+ rc = sqlite3VtabCallConnect(pParse, pTable);
+ db->nSchemaLock--;
+ return rc;
}
- if( IsVirtual(pTable) ) return 0;
#endif
#ifndef SQLITE_OMIT_VIEW
#ifndef SQLITE_OMIT_VIRTUALTABLE
int sqlite3ShadowTableName(sqlite3 *db, const char *zName);
int sqlite3IsShadowTableOf(sqlite3*,Table*,const char*);
+ void sqlite3MarkAllShadowTablesOf(sqlite3*, Table*);
#else
# define sqlite3ShadowTableName(A,B) 0
# define sqlite3IsShadowTableOf(A,B,C) 0
+# define sqlite3MarkAllShadowTablesOf(A,B)
#endif
int sqlite3VtabEponymousTableInit(Parse*,Module*);
void sqlite3VtabEponymousTableClear(sqlite3*,Module*);
iReg = ++pParse->nMem;
sqlite3VdbeLoadString(v, iReg, pTab->zName);
sqlite3VdbeAddOp2(v, OP_VCreate, iDb, iReg);
- }
-
- /* If we are rereading the sqlite_schema table create the in-memory
- ** record of the table. The xConnect() method is not called until
- ** the first time the virtual table is used in an SQL statement. This
- ** allows a schema that contains virtual tables to be loaded before
- ** the required virtual table implementations are registered. */
- else {
+ }else{
+ /* If we are rereading the sqlite_schema table create the in-memory
+ ** record of the table. */
Table *pOld;
Schema *pSchema = pTab->pSchema;
const char *zName = pTab->zName;
- assert( sqlite3SchemaMutexHeld(db, 0, pSchema) );
+ assert( zName!=0 );
+ sqlite3MarkAllShadowTablesOf(db, pTab);
pOld = sqlite3HashInsert(&pSchema->tblHash, zName, pTab);
if( pOld ){
sqlite3OomFault(db);
do_execsql_test 16.0 {
CREATE VIRTUAL TABLE y1 USING fts3;
+ VACUUM;
}
do_catchsql_test 16.10 {