1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-12 13:01:09 +03:00

Disable query flattening when the outer query is a compound SELECT and

the inner query has a LIMIT clause.  Ticket [02a8e81d44].

FossilOrigin-Name: f96782b389b5b97b488dc5814f7082e0393f64cd
This commit is contained in:
drh
2010-04-15 23:24:29 +00:00
parent ed808acd1b
commit f391327824
4 changed files with 45 additions and 13 deletions

View File

@@ -2526,8 +2526,8 @@ static void substSelect(
** (14) The subquery does not use OFFSET
**
** (15) The outer query is not part of a compound select or the
** subquery does not have both an ORDER BY and a LIMIT clause.
** (See ticket #2339)
** subquery does not have a LIMIT clause.
** (See ticket #2339 and ticket [02a8e81d44]).
**
** (16) The outer query is not an aggregate or the subquery does
** not contain ORDER BY. (Ticket #2942) This used to not matter
@@ -2610,7 +2610,7 @@ static int flattenSubquery(
** and (14). */
if( pSub->pLimit && p->pLimit ) return 0; /* Restriction (13) */
if( pSub->pOffset ) return 0; /* Restriction (14) */
if( p->pRightmost && pSub->pLimit && pSub->pOrderBy ){
if( p->pRightmost && pSub->pLimit ){
return 0; /* Restriction (15) */
}
if( pSubSrc->nSrc==0 ) return 0; /* Restriction (7) */