summaryrefslogtreecommitdiff
path: root/sql/sql_lex.cc
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2019-04-17 21:37:29 -0700
committerIgor Babaev <igor@askmonty.org>2019-04-17 21:37:29 -0700
commit59ed5f3aa4bc5a02a65f93b1d054ccc0fb2cd248 (patch)
treefb923464b33c0127e627d7e20b4ccc83f01648f1 /sql/sql_lex.cc
parente7029e864f4b2c8fa88362677ee8150cc479f07f (diff)
downloadmariadb-git-59ed5f3aa4bc5a02a65f93b1d054ccc0fb2cd248.tar.gz
MDEV-19164 Assertion `fixed' failed in Item_func_inet_aton::val_int
When pushing a condition from HAVING into WHERE the function st_select_lex::pushdown_from_having_into_where() transforms column references in the pushed condition then performs cleanup of items of the condition and finally calls fix_fields() for the condition items. The cleanup is performed by a call of the method walk() with cleanup_processor as the first parameter. Unfortunately this sequence of calls does not work if the condition contains cached items, because fix_fields() cannot go through Item_cache items and this leaves underlying items unfixed. The solution of this problem used in this patch is just does not allow to process Item_cache objects when performing cleanup of the pushed condition. In order to let the traversal procedure walk() not to process Item_cache objects the third parameter of the used call of walk() is set to a fictitious pointer (void *) 1. And Item_cache::walk() is changed to prevent any action when it gets such value as the third parameter.
Diffstat (limited to 'sql/sql_lex.cc')
-rw-r--r--sql/sql_lex.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index f74541b34a4..8ea0bc50956 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -10112,7 +10112,7 @@ Item *remove_pushed_top_conjuncts_for_having(THD *thd, Item *cond)
Multiple equalities are not removed but marked with DELETION_FL flag.
They will be deleted later in substitite_for_best_equal_field() called
for the HAVING condition.
- 5. Unwrap fields wrapped in Item_ref wrappers contain in the condition
+ 5. Unwrap fields wrapped in Item_ref wrappers contained in the condition
of attach_to_conds so the condition could be pushed into WHERE.
@note
@@ -10203,7 +10203,7 @@ Item *st_select_lex::pushdown_from_having_into_where(THD *thd, Item *having)
join->having_equal= 0;
/*
- 5. Unwrap fields wrapped in Item_ref wrappers contain in the condition
+ 5. Unwrap fields wrapped in Item_ref wrappers contained in the condition
of attach_to_conds so the condition could be pushed into WHERE.
*/
it.rewind();
@@ -10213,7 +10213,7 @@ Item *st_select_lex::pushdown_from_having_into_where(THD *thd, Item *having)
&Item::field_transformer_for_having_pushdown,
(uchar *)this);
- if (item->walk(&Item::cleanup_processor, 0, 0) ||
+ if (item->walk(&Item:: cleanup_processor, 0, STOP_PTR) ||
item->fix_fields(thd, NULL))
{
attach_to_conds.empty();