summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <igor@rurik.mysql.com>2006-09-29 11:36:27 -0700
committerunknown <igor@rurik.mysql.com>2006-09-29 11:36:27 -0700
commitf66945aadb88bc66efebdd5333e7baf8acf0fe30 (patch)
tree09106c2af35d65c519afb9dc8a33a06334a467b4 /sql
parentd1da520f9bc4366547d1b64f8a55e77a77127d61 (diff)
parent1643d0c5ed59826a03b294e38719012b3508c2eb (diff)
downloadmariadb-git-f66945aadb88bc66efebdd5333e7baf8acf0fe30.tar.gz
Merge ibabaev@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into rurik.mysql.com:/home/igor/mysql-5.0-opt mysql-test/r/select.result: Manual merge mysql-test/t/select.test: Manual merge
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_select.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index b328d9162d5..b814bd1d565 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -13513,7 +13513,19 @@ bool JOIN::alloc_func_list()
disctinct->group_by optimization
*/
if (select_distinct)
+ {
group_parts+= fields_list.elements;
+ /*
+ If the ORDER clause is specified then it's possible that
+ it also will be optimized, so reserve space for it too
+ */
+ if (order)
+ {
+ ORDER *ord;
+ for (ord= order; ord; ord= ord->next)
+ group_parts++;
+ }
+ }
/* This must use calloc() as rollup_make_fields depends on this */
sum_funcs= (Item_sum**) thd->calloc(sizeof(Item_sum**) * (func_count+1) +