aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrh <>2024-01-09 12:28:51 +0000
committerdrh <>2024-01-09 12:28:51 +0000
commitff6905a1a54d648834c5f9e1f548f3d0b32d2b2d (patch)
treee6e9b66b3def25dd37e912e44f0ef83388fefc32 /src
parente452bf40a14aca57fd9047b330dff282f3e4bbcc (diff)
downloadsqlite-ff6905a1a54d648834c5f9e1f548f3d0b32d2b2d.tar.gz
sqlite-ff6905a1a54d648834c5f9e1f548f3d0b32d2b2d.zip
Improved resolution of unqualified names in the REINDEX command.
[forum:/info/74cd0ceabd|Forum thread 74cd0ceabd]. FossilOrigin-Name: 97709ce2a1f5ae05495e412ca27108048e5b8a63a1e3bca4be13933f7527da7b
Diffstat (limited to 'src')
-rw-r--r--src/build.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/build.c b/src/build.c
index d2e9e0bc0..a2553da9f 100644
--- a/src/build.c
+++ b/src/build.c
@@ -5521,7 +5521,7 @@ void sqlite3Reindex(Parse *pParse, Token *pName1, Token *pName2){
if( iDb<0 ) return;
z = sqlite3NameFromToken(db, pObjName);
if( z==0 ) return;
- zDb = db->aDb[iDb].zDbSName;
+ zDb = pName2->n ? db->aDb[iDb].zDbSName : 0;
pTab = sqlite3FindTable(db, z, zDb);
if( pTab ){
reindexTable(pParse, pTab, 0);
@@ -5531,6 +5531,7 @@ void sqlite3Reindex(Parse *pParse, Token *pName1, Token *pName2){
pIndex = sqlite3FindIndex(db, z, zDb);
sqlite3DbFree(db, z);
if( pIndex ){
+ iDb = sqlite3SchemaToIndex(db, pIndex->pTable->pSchema);
sqlite3BeginWriteOperation(pParse, 0, iDb);
sqlite3RefillIndex(pParse, pIndex, -1);
return;