summaryrefslogtreecommitdiff
path: root/sql/item_cmpfunc.cc
diff options
context:
space:
mode:
authorunknown <timour@askmonty.org>2011-07-07 16:28:26 +0300
committerunknown <timour@askmonty.org>2011-07-07 16:28:26 +0300
commit4128ec48522534732d16a74cda006dc794748042 (patch)
treed770292ee97cf8aab9dd4931d7fee4f91de178ce /sql/item_cmpfunc.cc
parent801a4ebca96fa00c85e1ca068c9491ae3f813551 (diff)
downloadmariadb-git-4128ec48522534732d16a74cda006dc794748042.tar.gz
Fix bug lp:806943
Analysis: This bug is yet another incarnation of the generic problem where optimization of the outer query triggers evaluation of a subquery, and this evaluation performs a destructive change to the subquery plan. Specifically a temp table is created for the DISTINCT operation that replaces the original subquery table. Later, select_describe() attempts to print the table name, however, there is no corresponding TABLE_LIST object to the internal temp table, so we get a crash. Execution works fine because it is not interested in the corresponding TABLE_LIST object (or its name). Solution: Similar to other such bugs, block the evaluation of expensive Items in convert_const_to_int().
Diffstat (limited to 'sql/item_cmpfunc.cc')
-rw-r--r--sql/item_cmpfunc.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index dc25cf5942c..346ae243196 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -434,7 +434,7 @@ static bool convert_const_to_int(THD *thd, Item_field *field_item,
field_item->field_type() != MYSQL_TYPE_YEAR)
return 1;
- if ((*item)->const_item())
+ if ((*item)->const_item() && !(*item)->is_expensive())
{
TABLE *table= field->table;
ulong orig_sql_mode= thd->variables.sql_mode;