summaryrefslogtreecommitdiff
path: root/sql/item_sum.cc
diff options
context:
space:
mode:
authorunknown <gkodinov/kgeorge@magare.gmz>2007-10-08 12:57:43 +0300
committerunknown <gkodinov/kgeorge@magare.gmz>2007-10-08 12:57:43 +0300
commit6736d404a0a151316a608e0eb48c2264daadff89 (patch)
treea4479fe3cfe745c407d6d982f710e0e37bfe29ef /sql/item_sum.cc
parent554d405d73c5618b0dbca4e118a8739932a3a39f (diff)
downloadmariadb-git-6736d404a0a151316a608e0eb48c2264daadff89.tar.gz
Bug #31156: mysqld: item_sum.cc:918: virtual bool
Item_sum_distinct::setup(THD*): Assertion There was an assertion to detect a bug in ROLLUP implementation. However the assertion is not true when used in a subquery context with non-cacheable statements. Fixed by turning the assertion to accepted case (just like it's done for the other aggregate functions). mysql-test/r/func_group.result: Bug #31156: test case mysql-test/t/func_group.test: Bug #31156: test case sql/item_sum.cc: Bug #31156: make it OK to call setup() several times: done for (e.g.) scalar subquery
Diffstat (limited to 'sql/item_sum.cc')
-rw-r--r--sql/item_sum.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index c20d3fba705..6421f517b21 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -905,7 +905,9 @@ bool Item_sum_distinct::setup(THD *thd)
List<create_field> field_list;
create_field field_def; /* field definition */
DBUG_ENTER("Item_sum_distinct::setup");
- DBUG_ASSERT(tree == 0);
+ /* It's legal to call setup() more than once when in a subquery */
+ if (tree)
+ return FALSE;
/*
Virtual table and the tree are created anew on each re-execution of
@@ -2443,6 +2445,7 @@ bool Item_sum_count_distinct::setup(THD *thd)
/*
Setup can be called twice for ROLLUP items. This is a bug.
Please add DBUG_ASSERT(tree == 0) here when it's fixed.
+ It's legal to call setup() more than once when in a subquery
*/
if (tree || table || tmp_table_param)
return FALSE;