diff options
author | dan <Dan Kennedy> | 2024-03-13 15:44:31 +0000 |
---|---|---|
committer | dan <Dan Kennedy> | 2024-03-13 15:44:31 +0000 |
commit | e116fa153f752192ce96e285f7a3685549e0e2a4 (patch) | |
tree | 66e64d478b1874ad86c713d85af3269496f4bc79 /src/insert.c | |
parent | 609aba00d930c4909a1dfa313645847de5804b68 (diff) | |
download | sqlite-e116fa153f752192ce96e285f7a3685549e0e2a4.tar.gz sqlite-e116fa153f752192ce96e285f7a3685549e0e2a4.zip |
Ensure that if a multi-row VALUES cannot be coded while being parsed, the SF_MultiValue flag is correctly set.
FossilOrigin-Name: 94791824a6f04782aac6bc16c182685e2d6ebf5c688dc9f8d59e479c6fd5a40e
Diffstat (limited to 'src/insert.c')
-rw-r--r-- | src/insert.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/insert.c b/src/insert.c index 10eafaa41..7303e1950 100644 --- a/src/insert.c +++ b/src/insert.c @@ -616,13 +616,16 @@ Select *sqlite3MultiValues(Parse *pParse, Select *pLeft, ExprList *pRow){ || pLeft->pPrior || (pLeft->pSrc->nSrc==0 && multiValueIsConstantNoAff(pLeft->pEList)==0) ){ + /* This row of the VALUES clause cannot be coded immediately. */ int f = SF_Values | SF_MultiValue; - if( pLeft->pPrior || pLeft->pSrc->nSrc ){ + if( pLeft->pSrc->nSrc ){ sqlite3MultiValuesEnd(pParse, pLeft); f = SF_Values; + }else if( pLeft->pPrior ){ + /* In this case set the SF_MultiValue flag only if it was set on + ** the previous Select structure. */ + f = (f & pLeft->selFlags); } - /* This VALUES clause is part of a VIEW or some other schema item. In - ** this case the co-routine cannot be coded immediately. */ pSelect = sqlite3SelectNew(pParse,pRow,0,0,0,0,0,f,0); pLeft->selFlags &= ~SF_MultiValue; if( pSelect ){ |