1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

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
This commit is contained in:
drh
2024-03-18 16:30:00 +00:00
parent b03805b70b
commit c195e2374b
4 changed files with 106 additions and 10 deletions

View File

@@ -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;