WL#3916: GROUP_CONCAT: change type of "separator" from String to Item
Affects: Server-7.1 — Status: Un-Assigned — Priority: Medium
This task was inspired by BUG#28925 "GROUP_CONCAT inserts wrong separators for a ucs2 column". Type of GROUP_CONCAT separator should be changed from String to Item. The benefits: - Getting rid of extra code to process "separator". If it is added into the argument list, it will be just processed like another arguments in the things like character set and collation aggregation. Separator will be converted to the result character set and assigned to the result collation automatically. - Allowing using character set introducers for separators, which will be especially convenient for UCS2 + HEX: GROUP_CONCAT(ucs2_column SEPARATOR _ucs2 0x002C) Currently this is not possible, and produce syntax error. - Allowing expressions in separator - not only just literals. - Allowing binding of separator in prepared statements Idea of how it can be done: - remove the "String *separator" member from the Item_func_group_concat class, - add "uint arg_count_separator" member - change the type of separator from *String to *Item: in sql_yacc.yy and in arguments to constructor Item_func_group_concat::Item_func_group_concat() - if separator is given explicitly in the query, pass it to constructor and initialize arg_count_separator to 1. - if separator is not given explicitly, pass NULL to constructor and set arg_count_separator to 0. - In constructor: put the separator (if it exists) into the "args" array, between the "fields" and the "order" arguments. The first version of a patch implementing this idea: http://bugs.mysql.com/bug.php?id=28925 Thanks to Martin Friebe for providing it.
Copyright (c) 2000, 2016, Oracle Corporation and/or its affiliates. All rights reserved.