aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordan <Dan Kennedy>2024-03-18 11:12:22 +0000
committerdan <Dan Kennedy>2024-03-18 11:12:22 +0000
commit75924d3ae22587cac6c68caad9212a7621e47135 (patch)
tree508f2c02eb92b1d73d8965bee04e3d7865e31398 /src
parent2f4a8cc2d8f1ce29814a97887d9e8e96e9ed7725 (diff)
downloadsqlite-75924d3ae22587cac6c68caad9212a7621e47135.tar.gz
sqlite-75924d3ae22587cac6c68caad9212a7621e47135.zip
Ensure the database schema has been loaded and the database encoding gleaned before beginning to code a multi-row VALUES clause.
FossilOrigin-Name: 2ff476eb3d1f4a2146f4a48b57895a00a3ff5beb29afa679ae53ea58cac07c76
Diffstat (limited to 'src')
-rw-r--r--src/insert.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/insert.c b/src/insert.c
index 2c6a76b78..7d386f5d2 100644
--- a/src/insert.c
+++ b/src/insert.c
@@ -698,12 +698,20 @@ Select *sqlite3MultiValues(Parse *pParse, Select *pLeft, ExprList *pRow){
}else{
SrcItem *p = 0; /* SrcItem that reads from co-routine */
+
if( pLeft->pSrc->nSrc==0 ){
/* Co-routine has not yet been started and the special Select object
** that accesses the co-routine has not yet been created. This block
** does both those things. */
Vdbe *v = sqlite3GetVdbe(pParse);
Select *pRet = sqlite3SelectNew(pParse, 0, 0, 0, 0, 0, 0, 0, 0);
+
+ /* Ensure the database schema has been read. This is to ensure we have
+ ** the correct text encoding. */
+ if( (pParse->db->mDbFlags & DBFLAG_SchemaKnownOk)==0 ){
+ sqlite3ReadSchema(pParse);
+ }
+
if( pRet ){
SelectDest dest;
pRet->pSrc->nSrc = 1;