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

Fix the query flattener optimization so that it preserve the "SF_Compound"

bit when flattening a compound subquery into a non-compound outer query.
Failure to preserve that bit could allow subsequent flattenings which are
not valid. Fix for ticket [c41afac34f15781fe09cd].

FossilOrigin-Name: 523b42371122d9e1b3185425745f1490138bff7f7cc941ee26ee81df7ade5bf4
This commit is contained in:
drh
2019-05-29 17:22:38 +00:00
parent efdb371a1d
commit 7cd5e856e5
4 changed files with 29 additions and 14 deletions

View File

@@ -4045,10 +4045,10 @@ static int flattenSubquery(
substSelect(&x, pParent, 0);
}
/* The flattened query is distinct if either the inner or the
** outer query is distinct.
*/
pParent->selFlags |= pSub->selFlags & SF_Distinct;
/* The flattened query is a compound if either the inner or the
** outer query is a compound. */
pParent->selFlags |= pSub->selFlags & SF_Compound;
assert( (pSub->selFlags & SF_Distinct)==0 ); /* restriction (17b) */
/*
** SELECT ... FROM (SELECT ... LIMIT a OFFSET b) LIMIT x OFFSET y;