mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
fixed Bug #4358 Problem with HAVING clause that uses alias
from the select list and TEXT field make setup_copy_fields to insert Item_copy_string for blobs in the beginning of the copy_funcs (push_back instead of push_front) the thing is that Item_copy_string::copy for function can call Item_copy_string::val_int for blob via Item_ref. But if Item_copy_string::copy for blob isn't called before, it's value will be wrong. So all the Item_copy_string::copy for blobs should be called before Item_copy_string::copy for functions. mysql-test/r/having.result: added test case for Bug #4358 Problem with HAVING clause that uses alias from the select list and TEXT field mysql-test/t/having.test: added test case for Bug #4358 Problem with HAVING clause that uses alias from the select list and TEXT field sql/sql_select.cc: make setup_copy_fields to insert Item_copy_string for blobs in the beginning of the copy_funcs (push_back instead of push_front) the thing is that Item_copy_string::copy for function can call Item_copy_string::val_int for blob via Item_ref. But if Item_copy_string::copy for blob isn't called before, it's value will be wrong. So all the Item_copy_string::copy for blobs should be called before Item_copy_string::copy for functions. fixed Bug #4358 Problem with HAVING clause that uses alias from the select list and TEXT field
This commit is contained in:
@@ -7158,7 +7158,16 @@ setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields)
|
||||
if (!(pos=new Item_copy_string(pos)))
|
||||
goto err;
|
||||
VOID(li.replace(pos));
|
||||
if (param->copy_funcs.push_back(pos))
|
||||
/*
|
||||
Item_copy_string::copy for function can call
|
||||
Item_copy_string::val_int for blob via Item_ref.
|
||||
But if Item_copy_string::copy for blob isn't called before,
|
||||
it's value will be wrong
|
||||
so let's insert Item_copy_string for blobs in the beginning of
|
||||
copy_funcs
|
||||
(to see full test case look at having.test, BUG #4358)
|
||||
*/
|
||||
if (param->copy_funcs.push_front(pos))
|
||||
goto err;
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user