Skip to content

concat_ws on array arguments silently stringifies the arrays #21703

@hcrosse

Description

@hcrosse

Describe the bug

concat_ws(sep, array, array, ...) dispatches to the string concat_ws UDF, which coerces the array arguments to their string representation and joins them textually. For example:

select concat_ws(',', make_array(1, 2, 3), make_array(4, 5));

returns [1, 2, 3],[4, 5] instead of either rejecting the call as a type error or producing well-defined array semantics.

This is the same class of bug as #18020. Filing separately because the right fix is less obvious as concat_ws doesn't have a direct array equivalent the way concat maps to array_concat, so "reject with a plan error" may be the better answer here.

To Reproduce

select concat_ws(',', make_array(1, 2, 3), make_array(4, 5));
-- returns: [1, 2, 3],[4, 5]

Expected behavior

Either a plan error rejecting array arguments, or well-defined array semantics, not silent stringification.

Additional context

Noticed by @neilconway while reviewing #21689.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions