Re: string_to_array, array_to_string function without separator - Mailing list pgsql-hackers

From Pavel Stehule
Subject Re: string_to_array, array_to_string function without separator
Date
Msg-id CAFj8pRC9YRt_jJowLa6yJdpvQCHMN1+gq_MuiPmp9_vHd_k_yA@mail.gmail.com
Whole thread Raw
In response to Re: string_to_array, array_to_string function without separator  (Chapman Flack <chap@anastigmatix.net>)
Responses Re: string_to_array, array_to_string function without separator
List pgsql-hackers


pá 15. 3. 2019 v 17:54 odesílatel Chapman Flack <chap@anastigmatix.net> napsal:
On 3/15/19 12:26 PM, Pavel Stehule wrote:
> you use string_to_array function without separator, then only one possible
> semantic is there - separation by chars.

Other languages can and do specify other semantics for the
separator-omitted case: often (as in Python) it means to split
around "runs of one or more characters the platform considers white
space", as a convenience, given that it's a fairly commonly wanted
meaning but can be tedious to spell out as an explicit separator.

for this proposal "char" != byte

result[n] = substring(str FROM n FOR 1)


I admit I think a separator of '' would be more clear than null,
so if I were designing string_to_array in a green field, I think
I would swap the meanings of null and '' as the delimiter: null
would mean "don't really split anything", and '' would mean "split
everywhere you can find '' in the string", that is, everywhere.

But the current behavior is already established....

yes

Pavel

Regards,
-Chap

pgsql-hackers by date:

Previous
From: Chapman Flack
Date:
Subject: Re: string_to_array, array_to_string function without separator
Next
From: Chapman Flack
Date:
Subject: Re: string_to_array, array_to_string function without separator