Skip to content

group_concat() should ignore NULL #1542

@jasobrown-rs

Description

@jasobrown-rs

We do not filter out NULL values when accumulating values for mysql group_concat operations.

expected behavior

mysql> select group_concat(tag separator ':<>:') from tags where d_id = 1;
+---------------------------------------+
| group_concat(tag separator ':<>:')    |
+---------------------------------------+
| sheppard:<>:rotweiller:<>:black-brown |
+---------------------------------------+
1 row in set (0.01 sec)

actual behavior:

mysql> create cache from select group_concat(tag separator ':<>:') from tags where d_id = 1;
Query OK, 0 rows affected (0.09 sec)

mysql> select group_concat(tag separator ':<>:') from tags where d_id = 1;
+-----------------------------------------------------+
| group_concat(`noria`.`tags`.`tag` separator ':<>:') |
+-----------------------------------------------------+
| sheppard:<>:rotweiller:<>:black-brown:<>:NULL       |
+-----------------------------------------------------+
1 row in set (0.01 sec)

Note: this applies to pg string_agg() (REA-5905), as well as the existing json object agg functions.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions