diff options
author | dan <Dan Kennedy> | 2024-12-09 11:37:37 +0000 |
---|---|---|
committer | dan <Dan Kennedy> | 2024-12-09 11:37:37 +0000 |
commit | 94ad4abc656127fea3fe63d9263759d6adb60f65 (patch) | |
tree | 325dfcdc7744de5cb26d3a195297904cd60aad33 /src/select.c | |
parent | a42db7ff40d28b6a856a7da082456cc3fb161374 (diff) | |
parent | 4f5ae3fc4ec70b440d11154d5072961977264765 (diff) | |
download | sqlite-94ad4abc656127fea3fe63d9263759d6adb60f65.tar.gz sqlite-94ad4abc656127fea3fe63d9263759d6adb60f65.zip |
Fix an obscure problem with multiple outer joins, ON clauses and query flattening. Forum [forum:5c8a069d23|thread 5c8a069d23].
FossilOrigin-Name: a350ea7c6b89725ba1a0058c77fc8e918f5cb78e868d100f5425cdee114d1320
Diffstat (limited to 'src/select.c')
-rw-r--r-- | src/select.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/select.c b/src/select.c index 285e9133e..9d35e1832 100644 --- a/src/select.c +++ b/src/select.c @@ -4673,6 +4673,7 @@ static int flattenSubquery( /* Transfer the FROM clause terms from the subquery into the ** outer query. */ + iNewParent = pSubSrc->a[0].iCursor; for(i=0; i<nSubSrc; i++){ SrcItem *pItem = &pSrc->a[i+iFrom]; assert( pItem->fg.isTabFunc==0 ); @@ -4682,7 +4683,6 @@ static int flattenSubquery( if( pItem->fg.isUsing ) sqlite3IdListDelete(db, pItem->u3.pUsing); *pItem = pSubSrc->a[i]; pItem->fg.jointype |= ltorj; - iNewParent = pSubSrc->a[i].iCursor; memset(&pSubSrc->a[i], 0, sizeof(pSubSrc->a[i])); } pSrc->a[iFrom].fg.jointype &= JT_LTORJ; @@ -4722,6 +4722,7 @@ static int flattenSubquery( pWhere = pSub->pWhere; pSub->pWhere = 0; if( isOuterJoin>0 ){ + assert( pSubSrc->nSrc==1 ); sqlite3SetJoinExpr(pWhere, iNewParent, EP_OuterON); } if( pWhere ){ |