Re: string_to_array, array_to_string function without separator
От | Pavel Stehule |
---|---|
Тема | Re: string_to_array, array_to_string function without separator |
Дата | |
Msg-id | CAFj8pRCXZZLmwnP6qet+1p7=wwkiGNxNSZ7NP=SYXY2+sK7qFQ@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: string_to_array, array_to_string function without separator (Chapman Flack <chap@anastigmatix.net>) |
Список | pgsql-hackers |
pá 15. 3. 2019 v 16:59 odesílatel Chapman Flack <chap@anastigmatix.net> napsal:
On 3/15/19 11:46 AM, Pavel Stehule wrote:
> pá 15. 3. 2019 v 15:03 odesílatel David Fetter <david@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?
yes
Pavel
Regards,
-Chap
В списке pgsql-hackers по дате отправления: