Skip to content

Commit 273591d

Browse files
Oleksandr ByelkinOleksandr Byelkin
authored andcommitted
MDEV-14619: VIEW and GROUP_CONCAT
Correctly print separator string in single quotes.
1 parent 20089f5 commit 273591d

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

mysql-test/r/view.result

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5629,6 +5629,20 @@ PREPARE stmt FROM 'REPLACE INTO v2 SELECT a FROM t3';
56295629
ERROR HY000: Can not insert into join view 'test.v2' without fields list
56305630
drop view v1,v2;
56315631
drop table t3;
5632+
#
5633+
# MDEV-14619: VIEW and GROUP_CONCAT
5634+
#
5635+
CREATE TABLE t1 (str text);
5636+
INSERT INTO t1 VALUES ("My"),("SQL");
5637+
CREATE VIEW v1 AS SELECT GROUP_CONCAT(str SEPARATOR '\\') FROM t1;
5638+
SELECT * FROM v1;
5639+
GROUP_CONCAT(str SEPARATOR '\\')
5640+
My\SQL
5641+
SHOW CREATE VIEW v1;
5642+
View Create View character_set_client collation_connection
5643+
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select group_concat(`t1`.`str` separator '\\') AS `GROUP_CONCAT(str SEPARATOR '\\')` from `t1` latin1 latin1_swedish_ci
5644+
drop view v1;
5645+
drop table t1;
56325646
# -----------------------------------------------------------------
56335647
# -- End of 5.5 tests.
56345648
# -----------------------------------------------------------------

mysql-test/t/view.test

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5578,6 +5578,18 @@ PREPARE stmt FROM 'REPLACE INTO v2 SELECT a FROM t3';
55785578
drop view v1,v2;
55795579
drop table t3;
55805580

5581+
--echo #
5582+
--echo # MDEV-14619: VIEW and GROUP_CONCAT
5583+
--echo #
5584+
5585+
CREATE TABLE t1 (str text);
5586+
INSERT INTO t1 VALUES ("My"),("SQL");
5587+
CREATE VIEW v1 AS SELECT GROUP_CONCAT(str SEPARATOR '\\') FROM t1;
5588+
SELECT * FROM v1;
5589+
SHOW CREATE VIEW v1;
5590+
drop view v1;
5591+
drop table t1;
5592+
55815593
--echo # -----------------------------------------------------------------
55825594
--echo # -- End of 5.5 tests.
55835595
--echo # -----------------------------------------------------------------

sql/item_sum.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3656,7 +3656,7 @@ void Item_func_group_concat::print(String *str, enum_query_type query_type)
36563656
}
36573657
}
36583658
str->append(STRING_WITH_LEN(" separator \'"));
3659-
str->append(*separator);
3659+
str->append_for_single_quote(separator->ptr(), separator->length());
36603660
str->append(STRING_WITH_LEN("\')"));
36613661
}
36623662

0 commit comments

Comments
 (0)