summaryrefslogtreecommitdiff
path: root/sql/item.cc
diff options
context:
space:
mode:
authorGeorgi Kodinov <kgeorge@mysql.com>2008-10-06 17:17:25 +0300
committerGeorgi Kodinov <kgeorge@mysql.com>2008-10-06 17:17:25 +0300
commit89d2b8efb9a45145b44b56aa5bdd2b341b46b382 (patch)
treefd3c4a772bff3c4ffe469097f4648fb887fdc22a /sql/item.cc
parent58f30a5886c117c9123986a3452364422ef395dd (diff)
downloadmariadb-git-89d2b8efb9a45145b44b56aa5bdd2b341b46b382.tar.gz
Bug#34773: query with explain extended and derived table / other table
crashes server When creating temporary table that contains aggregate functions a non-reversible source transformation was performed to redirect aggregate function arguments towards temporary table columns. This caused EXPLAIN EXTENDED to fail because it was trying to resolve references to the (freed) temporary table. Fixed by preserving the original aggregate function arguments and using them (instead of the transformed ones) for EXPLAIN EXTENDED. mysql-test/r/explain.result: Bug#34773: test case mysql-test/t/explain.test: Bug#34773: test case sql/item.cc: Bug#34773: use accessor functions instead of public members sql/item_sum.cc: Bug#34773: - Encapsulate the arguments into Item_sum and provide accessor and mutator methods - print the orginal arguments (if present) in EXPLAIN EXTENDED - preserve the original arguments list. sql/item_sum.h: Bug#34773: - Encapsulate the arguments into Item_sum and provide accessor and mutator methods - print the orginal arguments (if present) in EXPLAIN EXTENDED - preserve the original arguments list. sql/opt_range.cc: Bug#34773: use accessor functions instead of public members sql/opt_sum.cc: Bug#34773: use accessor functions instead of public members sql/sql_select.cc: Bug#34773: use accessor functions instead of public members
Diffstat (limited to 'sql/item.cc')
-rw-r--r--sql/item.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/sql/item.cc b/sql/item.cc
index 96408a70bdd..e603bcc24f5 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -6919,7 +6919,7 @@ enum_field_types Item_type_holder::get_real_type(Item *item)
*/
Item_sum *item_sum= (Item_sum *) item;
if (item_sum->keep_field_type())
- return get_real_type(item_sum->args[0]);
+ return get_real_type(item_sum->get_arg(0));
break;
}
case FUNC_ITEM:
@@ -7182,7 +7182,7 @@ void Item_type_holder::get_full_info(Item *item)
if (item->type() == Item::SUM_FUNC_ITEM &&
(((Item_sum*)item)->sum_func() == Item_sum::MAX_FUNC ||
((Item_sum*)item)->sum_func() == Item_sum::MIN_FUNC))
- item = ((Item_sum*)item)->args[0];
+ item = ((Item_sum*)item)->get_arg(0);
/*
We can have enum/set type after merging only if we have one enum|set
field (or MIN|MAX(enum|set field)) and number of NULL fields