diff options
author | drh <> | 2024-03-18 16:30:00 +0000 |
---|---|---|
committer | drh <> | 2024-03-18 16:30:00 +0000 |
commit | c195e2374b63d29190e00a74482238eaf426d73f (patch) | |
tree | 8798307cf57e5d3e4454544e0e717b63aceb488d /src/insert.c | |
parent | b03805b70b1312dc92b6a394ac0d09be132e6a68 (diff) | |
download | sqlite-c195e2374b63d29190e00a74482238eaf426d73f.tar.gz sqlite-c195e2374b63d29190e00a74482238eaf426d73f.zip |
Allow the VALUES-as-coroutine optimization to be applied to later rows of
a VALUES clause even if earlier rows do not qualify.
FossilOrigin-Name: 9a47ea7f0f675f7bf4710901487ce34c7689e618cd1d8b9f94f0ff7ebc3f2841
Diffstat (limited to 'src/insert.c')
-rw-r--r-- | src/insert.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/insert.c b/src/insert.c index be558be78..a87d714a0 100644 --- a/src/insert.c +++ b/src/insert.c @@ -670,8 +670,7 @@ static int exprListIsNoAffinity(Parse *pParse, ExprList *pRow){ */ Select *sqlite3MultiValues(Parse *pParse, Select *pLeft, ExprList *pRow){ - if( pLeft->pPrior /* co-routine precluded by prior row */ - || pParse->bHasWith /* condition (a) above */ + if( pParse->bHasWith /* condition (a) above */ || pParse->db->init.busy /* condition (b) above */ || exprListIsConstant(pParse,pRow)==0 /* condition (c) above */ || (pLeft->pSrc->nSrc==0 && @@ -714,6 +713,12 @@ Select *sqlite3MultiValues(Parse *pParse, Select *pLeft, ExprList *pRow){ if( pRet ){ SelectDest dest; pRet->pSrc->nSrc = 1; + pRet->pPrior = pLeft->pPrior; + pRet->op = pLeft->op; + pLeft->pPrior = 0; + pLeft->op = TK_SELECT; + assert( pLeft->pNext==0 ); + assert( pRet->pNext==0 ); p = &pRet->pSrc->a[0]; p->pSelect = pLeft; p->fg.viaCoroutine = 1; |