summaryrefslogtreecommitdiff
path: root/sql/sql_derived.cc
diff options
context:
space:
mode:
authorGalina Shalygina <galina.shalygina@mariadb.com>2019-03-23 15:28:22 +0300
committerGalina Shalygina <galina.shalygina@mariadb.com>2019-04-04 18:06:56 +0300
commitae15f91f227015b3e1ad3f566db9396232cf0a3f (patch)
tree28fa79f3fe624576ef3351f897b77558e7207330 /sql/sql_derived.cc
parent3a3d5ba2356b85626d34d6a65e4d8e8e6205b60d (diff)
downloadmariadb-git-ae15f91f227015b3e1ad3f566db9396232cf0a3f.tar.gz
MDEV-18769 Assertion `fixed == 1' failed in Item_cond_or::val_int
This bug is caused by pushdown from HAVING into WHERE. It appears because condition that is pushed wasn't fixed. It is also discovered that condition pushdown from HAVING into WHERE is done wrong. There is no need to build clones for some conditions that can be pushed. They can be simply moved from HAVING into WHERE without cloning. build_pushable_cond_for_having_pushdown(), remove_pushed_top_conjuncts_for_having() methods are changed. It is found that there is no transformation made for fields of pushed condition. field_transformer_for_having_pushdown transformer is added. New tests are added. Some comments are changed.
Diffstat (limited to 'sql/sql_derived.cc')
-rw-r--r--sql/sql_derived.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc
index 1ad97e4244d..548383e818c 100644
--- a/sql/sql_derived.cc
+++ b/sql/sql_derived.cc
@@ -47,7 +47,6 @@ bool mysql_derived_fill(THD *thd, LEX *lex, TABLE_LIST *derived);
bool mysql_derived_reinit(THD *thd, LEX *lex, TABLE_LIST *derived);
bool mysql_derived_merge_for_insert(THD *thd, LEX *lex, TABLE_LIST *derived);
-
dt_processor processors[]=
{
&mysql_derived_init,
@@ -1463,7 +1462,13 @@ bool pushdown_cond_for_derived(THD *thd, Item *cond, TABLE_LIST *derived)
if (!remaining_cond)
continue;
- sl->mark_or_conds_to_avoid_pushdown(remaining_cond);
+ if (remaining_cond->walk(&Item::cleanup_excluding_const_fields_processor,
+ 0, 0))
+ continue;
+
+ mark_or_conds_to_avoid_pushdown(remaining_cond);
+
+ sl->cond_pushed_into_having= remaining_cond;
}
thd->lex->current_select= save_curr_select;
DBUG_RETURN(false);