bug report: concat_ws() omits blank strings
(1) By vafylec on 2025-06-10 23:38:02 [source]
In MySQL/PostgreSQL:
SELECT concat_ws('|', 'a', '', 'b', NULL, 'c'); returns 'a||b|c'.
In SQLite (v3.44-v3.50.1):
SELECT concat_ws('|', 'a', '', 'b', NULL, 'c'); returns 'a|b|c'.
This appears to be a bug.
It correctly omits nulls.
It incorrectly omits blank strings.
The documentation states:
The concat_ws(SEP,...) function returns a string that is the concatenation of all non-null arguments beyond the first argument, using the text value of the first argument as a separator.
My bold.
Many thanks for SQLite, one of my favourite (I'm British) and most-used pieces of software!
(2) By Richard Hipp (drh) on 2025-06-11 00:03:42 in reply to 1 [link] [source]
Fixed at check-in 2025-06-11T00:01Z. Thanks for the report.
(3) By violin (yuelinwang) on 2025-10-12 13:46:23 in reply to 2 [link] [source]
An interesting finding is:
sqlite> select concat_ws('|','','a');
a
Perhaps, according to the description, it should be: |a.
(4.1) By Bo Lindbergh (_blgl_) on 2025-10-14 02:41:32 edited from 4.0 in reply to 3 [link] [source]
Fixed here. The comment should probably say "at least one NOT NULL argument" instead of "at least NOT NULL argument", though.