Skip to content

Commit b37dcfa

Browse files
committed
Bug#34703610: Create view with subquery assertion error
The problem is a missing check for view context analysis mode when resolving a GROUP_CONCAT aggregate function. Fixed by adding the check. Change-Id: Id2e4d6964b5a5f8e4154c7c7af38875149c2452f Change-Id: Ic80259e754f42b56e42e36db9ab9b8d101016317
1 parent 0c789e5 commit b37dcfa

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

mysql-test/r/func_gconcat.result

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1371,3 +1371,6 @@ GROUP_CONCAT('32689,34068,34370,34930,37034,37638,38478,38643,38925,39889,40497,
13711371
LENGTH(t.value)
13721372
260
13731373
SET SESSION group_concat_max_len=default;
1374+
# Bug#34703610: Create view with subquery assertion error
1375+
CREATE VIEW v(c0) AS SELECT group_concat((SELECT 1), 1);
1376+
DROP VIEW v;

mysql-test/t/func_gconcat.test

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,3 +1017,9 @@ SELECT LENGTH(t.value) FROM (SELECT
10171017
GROUP_CONCAT('32689,34068,34370,34930,37034,37638,38478,38643,38925,39889,40497,41729,43085,43115,43500,44781,46344,46411,47173,47228,47623,48576,50293,50653,51794,54177,55347,55398,59492,59598,59804,59969,60612,62024,62754,62796,64647,68679,68974,69482,69625,70162,71100000') AS value ) t;
10181018

10191019
SET SESSION group_concat_max_len=default;
1020+
1021+
--echo # Bug#34703610: Create view with subquery assertion error
1022+
1023+
CREATE VIEW v(c0) AS SELECT group_concat((SELECT 1), 1);
1024+
1025+
DROP VIEW v;

sql/item_sum.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4464,7 +4464,8 @@ bool Item_func_group_concat::fix_fields(THD *thd, Item **ref) {
44644464
for (uint i = 0; i < m_field_arg_count; i++) {
44654465
Item *item = args[i];
44664466
fields.push_back(item);
4467-
if (item->const_item() && item->is_null()) {
4467+
if (item->const_item() && !thd->lex->is_view_context_analysis() &&
4468+
item->is_null()) {
44684469
// "is_null()" may cause error:
44694470
if (thd->is_error()) return true;
44704471
always_null = true;

0 commit comments

Comments
 (0)