mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-11 01:42:22 +03:00
Disable the push-down optimization for sub-queries that are INTERSECT, UNION or EXCEPT compounds. dbsqlfuzz a34f455c91ad75a0cf8cd9476841903f42930a7a.
FossilOrigin-Name: 346a3b12b861ce7ba369e98cd336f79a1d4f7a7bb9acd7a4f63f37b391755bf5
This commit is contained in:
11
src/select.c
11
src/select.c
@@ -5009,6 +5009,13 @@ static int pushDownWindowCheck(Parse *pParse, Select *pSubq, Expr *pExpr){
|
||||
** be materialized. (This restriction is implemented in the calling
|
||||
** routine.)
|
||||
**
|
||||
** (8) The subquery may not be a compound that uses UNION, INTERSECT,
|
||||
** or EXCEPT. (We could, perhaps, relax this restriction to allow
|
||||
** this case if none of the comparisons operators between left and
|
||||
** right arms of the compound use a collation other than BINARY.
|
||||
** But it is a lot of work to check that case for an obscure and
|
||||
** minor optimization, so we omit it for now.)
|
||||
**
|
||||
** Return 0 if no changes are made and non-zero if one or more WHERE clause
|
||||
** terms are duplicated into the subquery.
|
||||
*/
|
||||
@@ -5028,6 +5035,10 @@ static int pushDownWhereTerms(
|
||||
if( pSubq->pPrior ){
|
||||
Select *pSel;
|
||||
for(pSel=pSubq; pSel; pSel=pSel->pPrior){
|
||||
u8 op = pSel->op;
|
||||
assert( op==TK_ALL || op==TK_SELECT
|
||||
|| op==TK_UNION || op==TK_INTERSECT || op==TK_EXCEPT );
|
||||
if( op!=TK_ALL && op!=TK_SELECT ) return 0; /* restriction (8) */
|
||||
if( pSel->pWin ) return 0; /* restriction (6b) */
|
||||
}
|
||||
}else{
|
||||
|
||||
Reference in New Issue
Block a user