mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Fix of problem with WHERE/HAVING consist of alone outer reference field by wrapping it.
sql/item.cc: Wrapper added. sql/item.h: Wrapper added. sql/mysql_priv.h: Wrap function added. sql/sql_base.cc: Wrap function added. Fix of problem with WHERE consist of alone outer reference field by wrapping it. sql/sql_select.cc: Fix of problem with HAVING consist of alone outer reference field by wrapping it.
This commit is contained in:
@@ -543,6 +543,13 @@ JOIN::prepare(Item ***rref_pointer_array,
|
||||
thd->where="having clause";
|
||||
thd->lex->allow_sum_func|= 1 << select_lex_arg->nest_level;
|
||||
select_lex->having_fix_field= 1;
|
||||
/*
|
||||
Wrap alone field in HAVING clause in case it will be outer field of subquery
|
||||
which need persistent pointer on it, but having could be changed by optimizer
|
||||
*/
|
||||
if (having->type() == Item::REF_ITEM &&
|
||||
((Item_ref *)having)->ref_type() == Item_ref::REF)
|
||||
wrap_ident(thd, &having);
|
||||
bool having_fix_rc= (!having->fixed &&
|
||||
(having->fix_fields(thd, &having) ||
|
||||
having->check_cols(1)));
|
||||
|
Reference in New Issue
Block a user