mirror of
https://github.com/MariaDB/server.git
synced 2025-02-01 11:31:51 +01:00
Manual merge from 5.1
This commit is contained in:
commit
733f3b561d
4 changed files with 51 additions and 4 deletions
|
@ -1003,6 +1003,7 @@ SELECT 1 FROM
|
|||
1
|
||||
1
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests
|
||||
#
|
||||
# Bug #52397: another crash with explain extended and group_concat
|
||||
#
|
||||
|
@ -1018,7 +1019,25 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||
Warnings:
|
||||
Note 1003 select 1 AS `1` from dual
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests
|
||||
#
|
||||
# Bug #54476: crash when group_concat and 'with rollup' in prepared statements
|
||||
#
|
||||
CREATE TABLE t1 (a INT);
|
||||
INSERT INTO t1 VALUES (1), (2);
|
||||
PREPARE stmt FROM "SELECT GROUP_CONCAT(t1.a ORDER BY t1.a) FROM t1 JOIN t1 t2 GROUP BY t1.a WITH ROLLUP";
|
||||
EXECUTE stmt;
|
||||
GROUP_CONCAT(t1.a ORDER BY t1.a)
|
||||
1,1
|
||||
2,2
|
||||
1,1,2,2
|
||||
EXECUTE stmt;
|
||||
GROUP_CONCAT(t1.a ORDER BY t1.a)
|
||||
1,1
|
||||
2,2
|
||||
1,1,2,2
|
||||
DEALLOCATE PREPARE stmt;
|
||||
DROP TABLE t1;
|
||||
End of 5.1 tests
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
CREATE TABLE t1 (a VARCHAR(6), b INT);
|
||||
CREATE TABLE t2 (a VARCHAR(6), b INT);
|
||||
|
|
|
@ -708,6 +708,7 @@ SELECT 1 FROM
|
|||
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
||||
--echo #
|
||||
--echo # Bug #52397: another crash with explain extended and group_concat
|
||||
|
@ -719,8 +720,19 @@ EXPLAIN EXTENDED SELECT 1 FROM
|
|||
t1 t2, t1 GROUP BY t1.a) AS d;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # Bug #54476: crash when group_concat and 'with rollup' in prepared statements
|
||||
--echo #
|
||||
|
||||
--echo End of 5.0 tests
|
||||
CREATE TABLE t1 (a INT);
|
||||
INSERT INTO t1 VALUES (1), (2);
|
||||
|
||||
PREPARE stmt FROM "SELECT GROUP_CONCAT(t1.a ORDER BY t1.a) FROM t1 JOIN t1 t2 GROUP BY t1.a WITH ROLLUP";
|
||||
EXECUTE stmt;
|
||||
EXECUTE stmt;
|
||||
|
||||
DEALLOCATE PREPARE stmt;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug#36785: Wrong error message when group_concat() exceeds max length
|
||||
|
|
|
@ -3058,7 +3058,6 @@ Item_func_group_concat::Item_func_group_concat(THD *thd,
|
|||
tree(item->tree),
|
||||
unique_filter(item->unique_filter),
|
||||
table(item->table),
|
||||
order(item->order),
|
||||
context(item->context),
|
||||
arg_count_order(item->arg_count_order),
|
||||
arg_count_field(item->arg_count_field),
|
||||
|
@ -3071,6 +3070,24 @@ Item_func_group_concat::Item_func_group_concat(THD *thd,
|
|||
{
|
||||
quick_group= item->quick_group;
|
||||
result.set_charset(collation.collation);
|
||||
|
||||
/*
|
||||
Since the ORDER structures pointed to by the elements of the 'order' array
|
||||
may be modified in find_order_in_list() called from
|
||||
Item_func_group_concat::setup(), create a copy of those structures so that
|
||||
such modifications done in this object would not have any effect on the
|
||||
object being copied.
|
||||
*/
|
||||
ORDER *tmp;
|
||||
if (!(order= (ORDER **) thd->alloc(sizeof(ORDER *) * arg_count_order +
|
||||
sizeof(ORDER) * arg_count_order)))
|
||||
return;
|
||||
tmp= (ORDER *)(order + arg_count_order);
|
||||
for (uint i= 0; i < arg_count_order; i++, tmp++)
|
||||
{
|
||||
memcpy(tmp, item->order[i], sizeof(ORDER));
|
||||
order[i]= tmp;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -205,7 +205,6 @@ typedef struct st_order {
|
|||
struct st_order *next;
|
||||
Item **item; /* Point at item in select fields */
|
||||
Item *item_ptr; /* Storage for initial item */
|
||||
Item **item_copy; /* For SPs; the original item ptr */
|
||||
int counter; /* position in SELECT list, correct
|
||||
only if counter_used is true*/
|
||||
bool asc; /* true if ascending */
|
||||
|
|
Loading…
Add table
Reference in a new issue