Commit 98fd2995 authored by MySQL Build Team's avatar MySQL Build Team

Backport into build-201102032246-5.1.52sp1

> ------------------------------------------------------------
> revno: 3517
> revision-id: sergey.glukhov@oracle.com-20101213103926-okypkn10adeeyns8
> parent: davi.arnaut@oracle.com-20101207150620-s49dstok48oy585o
> committer: Sergey Glukhov <sergey.glukhov@oracle.com>
> branch nick: mysql-5.1-bugteam
> timestamp: Mon 2010-12-13 13:39:26 +0300
> message:
>   Bug#58396 group_concat and explain extended are still crashy
>   Explain fails at fix_fields stage and some items are left unfixed,
>   particulary Item_group_concat. Item_group_concat::orig_args field
>   is uninitialized in this case and Item_group_concat::print call 
>   leads to crash.
>   The fix:
>   move the initialization of Item_group_concat::orig_args
>   into constructor.
parent a4bfe7e0
...@@ -1029,4 +1029,16 @@ GROUP_CONCAT(t1.a ORDER BY t1.a) ...@@ -1029,4 +1029,16 @@ GROUP_CONCAT(t1.a ORDER BY t1.a)
1,1,2,2 1,1,2,2
DEALLOCATE PREPARE stmt; DEALLOCATE PREPARE stmt;
DROP TABLE t1; DROP TABLE t1;
#
# Bug#58396 group_concat and explain extended are still crashy
#
CREATE TABLE t1(a INT);
EXPLAIN EXTENDED SELECT UPDATEXML('1', a, '1')
FROM t1 ORDER BY (SELECT GROUP_CONCAT(1) FROM t1);
ERROR HY000: Only constant XPATH queries are supported
SHOW WARNINGS;
Level Code Message
Error 1105 Only constant XPATH queries are supported
Note 1003 select updatexml('1',`test`.`t1`.`a`,'1') AS `UPDATEXML('1', a, '1')` from `test`.`t1` order by (select group_concat(1 separator ',') from `test`.`t1`)
DROP TABLE t1;
End of 5.1 tests End of 5.1 tests
...@@ -734,4 +734,15 @@ EXECUTE stmt; ...@@ -734,4 +734,15 @@ EXECUTE stmt;
DEALLOCATE PREPARE stmt; DEALLOCATE PREPARE stmt;
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # Bug#58396 group_concat and explain extended are still crashy
--echo #
CREATE TABLE t1(a INT);
--error ER_UNKNOWN_ERROR
EXPLAIN EXTENDED SELECT UPDATEXML('1', a, '1')
FROM t1 ORDER BY (SELECT GROUP_CONCAT(1) FROM t1);
SHOW WARNINGS;
DROP TABLE t1;
--echo End of 5.1 tests --echo End of 5.1 tests
...@@ -3003,6 +3003,7 @@ Item_func_group_concat(Name_resolution_context *context_arg, ...@@ -3003,6 +3003,7 @@ Item_func_group_concat(Name_resolution_context *context_arg,
order_item->item= arg_ptr++; order_item->item= arg_ptr++;
} }
} }
memcpy(orig_args, args, sizeof(Item*) * arg_count);
} }
...@@ -3233,7 +3234,6 @@ Item_func_group_concat::fix_fields(THD *thd, Item **ref) ...@@ -3233,7 +3234,6 @@ Item_func_group_concat::fix_fields(THD *thd, Item **ref)
if (check_sum_func(thd, ref)) if (check_sum_func(thd, ref))
return TRUE; return TRUE;
memcpy (orig_args, args, sizeof (Item *) * arg_count);
fixed= 1; fixed= 1;
return FALSE; return FALSE;
} }
......
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