Skip to content

Commit dd08291

Browse files
authored
Continue to back away from the LEFT JOIN optimization of check-in [41c27bc0ff1d3135] by disallowing query flattening if the outer query is DISTINCT (#139)
1 parent 8d19776 commit dd08291

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

‎vendor/sqlite3/sqlite3.c‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128093,9 +128093,11 @@ static int flattenSubquery(
128093128093
*/
128094128094
if( (pSubitem->fg.jointype & JT_OUTER)!=0 ){
128095128095
isLeftJoin = 1;
128096-
if( pSubSrc->nSrc>1 || isAgg || IsVirtual(pSubSrc->a[0].pTab) ){
128097-
/* (3a) (3c) (3b) */
128098-
return 0;
128096+
if( pSubSrc->nSrc>1 /* (3a) */
128097+
|| isAgg /* (3b) */
128098+
|| IsVirtual(pSubSrc->a[0].pTab) /* (3c) */
128099+
|| (p->selFlags & SF_Distinct)!=0 /* (3d) */
128100+
){
128099128101
}
128100128102
}
128101128103
#ifdef SQLITE_EXTRA_IFNULLROW

0 commit comments

Comments
 (0)