On 3/15/19 11:46 AM, Pavel Stehule wrote: > pá 15. 3. 2019 v 15:03 odesílatel David Fetter <da...@fetter.org> napsal: >> Whatever optimizations you have in mind for this, could they also work >> for string_to_array() and array_to_string() when they get an empty >> string handed to them? > > my idea is use string_to_array('AHOJ') --> {A,H,O,J} > > empty input means empty result --> {}
I thought the question was maybe about an empty /delimiter/ string. It seems that string_to_array already has this behavior if NULL is passed as the delimiter: > select string_to_array('AHOJ', null); string_to_array ----------------- {A,H,O,J} and array_to_string has the proposed behavior if passed an empty string as the delimiter (as one would naturally expect) ... but not null for a delimiter (that just makes the result null). So the proposal seems roughly equivalent to making string_to_array's second parameter optional default null, and array_to_string's second parameter optional default ''. Does that sound right? Regards, -Chap