aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrh <>2025-03-10 22:31:55 +0000
committerdrh <>2025-03-10 22:31:55 +0000
commit642479d1cd44171e258aa5e7a36f9d2472356008 (patch)
treed62446535c38a303c05ae6f16e6b844f452f771b /src
parent09eba154b235f35a710da1d0096d9e1b3d5bda04 (diff)
downloadsqlite-642479d1cd44171e258aa5e7a36f9d2472356008.tar.gz
sqlite-642479d1cd44171e258aa5e7a36f9d2472356008.zip
Ensure that the TEMP database has been initialized at the beginning of
a call to sqlite3_open_blob() for the TEMP database. Fix for the issue reported by [forum:/forumpost/0a556d619b|forum post 0a556d619b]. FossilOrigin-Name: 2cfccdbe08b7b14a6b255f7157ac20d0807327adefcb33fcffeeed14c7603fe1
Diffstat (limited to 'src')
-rw-r--r--src/vdbeblob.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/vdbeblob.c b/src/vdbeblob.c
index 79698d0af..42edcf7de 100644
--- a/src/vdbeblob.c
+++ b/src/vdbeblob.c
@@ -133,6 +133,7 @@ int sqlite3_blob_open(
char *zErr = 0;
Table *pTab;
Incrblob *pBlob = 0;
+ int iDb;
Parse sParse;
#ifdef SQLITE_ENABLE_API_ARMOR
@@ -178,7 +179,10 @@ int sqlite3_blob_open(
sqlite3ErrorMsg(&sParse, "cannot open view: %s", zTable);
}
#endif
- if( !pTab ){
+ if( pTab==0
+ || ((iDb = sqlite3SchemaToIndex(db, pTab->pSchema))==1 &&
+ sqlite3OpenTempDatabase(&sParse))
+ ){
if( sParse.zErrMsg ){
sqlite3DbFree(db, zErr);
zErr = sParse.zErrMsg;
@@ -189,7 +193,7 @@ int sqlite3_blob_open(
goto blob_open_out;
}
pBlob->pTab = pTab;
- pBlob->zDb = db->aDb[sqlite3SchemaToIndex(db, pTab->pSchema)].zDbSName;
+ pBlob->zDb = db->aDb[iDb].zDbSName;
/* Now search pTab for the exact column. */
iCol = sqlite3ColumnIndex(pTab, zColumn);
@@ -273,7 +277,6 @@ int sqlite3_blob_open(
{OP_Halt, 0, 0, 0}, /* 5 */
};
Vdbe *v = (Vdbe *)pBlob->pStmt;
- int iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
VdbeOp *aOp;
sqlite3VdbeAddOp4Int(v, OP_Transaction, iDb, wrFlag,