mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-12 13:01:09 +03:00
Disable the LEFT JOIN flattening optimization for aggregate queries, as it
does not currently work. Further fix for ticket [cad1ab4cb7b0fc344]. FossilOrigin-Name: 05ada741554b9fd00befcf7b4083637f53de68699ae5210ac18e0773ad1a9910
This commit is contained in:
10
src/select.c
10
src/select.c
@@ -3301,7 +3301,8 @@ static void substSelect(
|
||||
** due to ticket [2f7170d73bf9abf80] from 2015-02-09.)
|
||||
**
|
||||
** (3) The subquery is not the right operand of a LEFT JOIN
|
||||
** or the subquery is not itself a join.
|
||||
** or the subquery is not itself a join and the outer query is not
|
||||
** an aggregate.
|
||||
**
|
||||
** (4) The subquery is not DISTINCT.
|
||||
**
|
||||
@@ -3497,11 +3498,16 @@ static int flattenSubquery(
|
||||
**
|
||||
** which is not at all the same thing.
|
||||
**
|
||||
** If the subquery is the right operand of a LEFT JOIN, then the outer
|
||||
** query cannot be an aggregate. This is an artifact of the way aggregates
|
||||
** are processed - there is not mechanism to determine if the LEFT JOIN
|
||||
** table should be all-NULL.
|
||||
**
|
||||
** See also tickets #306, #350, and #3300.
|
||||
*/
|
||||
if( (pSubitem->fg.jointype & JT_OUTER)!=0 ){
|
||||
isLeftJoin = 1;
|
||||
if( pSubSrc->nSrc>1 ){
|
||||
if( pSubSrc->nSrc>1 || isAgg ){
|
||||
return 0; /* Restriction (3) */
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user