Commit 489da70f authored by unknown's avatar unknown

fixed fix_fields() parameters for GROUP_CONCAT() ORDER BY clause

(BUG#1537)


mysql-test/r/func_gconcat.result:
  test of BUG#1537
mysql-test/t/func_gconcat.test:
  test of BUG#1537
sql/item_sum.cc:
  passing correct address of pointer to item to fix_dields(), using that addres to get access to item after fix_fields
parent 4a3d6646
......@@ -196,3 +196,14 @@ insert into t1 values('test'),('test2');
select * from t1 having group_concat(bar)='';
bar
drop table t1;
create table t1 (a int, a1 varchar(10));
create table t2 (a0 int);
insert into t1 values (0,"a"),(0,"b"),(1,"c");
insert into t2 values (1),(2),(3);
select group_concat(a1 order by (t1.a IN (select a0 from t2))) from t1;
group_concat(a1 order by (t1.a IN (select a0 from t2)))
b,a,c
select group_concat(a1 order by (t1.a)) from t1;
group_concat(a1 order by (t1.a))
b,a,c
drop table t1, t2;
......@@ -119,4 +119,11 @@ insert into t1 values('test'),('test2');
select * from t1 having group_concat(bar)='';
drop table t1;
# ORDER BY fix_fields()
create table t1 (a int, a1 varchar(10));
create table t2 (a0 int);
insert into t1 values (0,"a"),(0,"b"),(1,"c");
insert into t2 values (1),(2),(3);
select group_concat(a1 order by (t1.a IN (select a0 from t2))) from t1;
select group_concat(a1 order by (t1.a)) from t1;
drop table t1, t2;
\ No newline at end of file
......@@ -1773,8 +1773,8 @@ Item_func_group_concat::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
for (i= 0 ; i < arg_count_order ; i++)
{
ORDER *order_item= order[i];
Item *item=*order_item->item;
if (item->fix_fields(thd, tables, &item) || item->check_cols(1))
if ((*order_item->item)->fix_fields(thd, tables, order_item->item) ||
(*order_item->item)->check_cols(1))
return 1;
}
result_field= 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment