Re: [HACKERS] string_to_array with empty input

Поиск
Список
Период
Сортировка
От Steve Crawford
Тема Re: [HACKERS] string_to_array with empty input
Дата
Msg-id 49D40762.6090908@pinpointresearch.com
обсуждение исходный текст
Ответ на Re: [HACKERS] string_to_array with empty input  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: [HACKERS] string_to_array with empty input  ("Leif B. Kristensen" <leif@solumslekt.org>)
Список pgsql-general
Tom Lane wrote:
>
> I'm starting to vacillate again.  It's clear that for the purposes
> of string_to_array, an empty input string is fundamentally ambiguous:
> it could mean a list of no things, or a list of one empty thing.
>
Agreed. Of the two, a list of one empty thing makes string_to_array
closer to an inverse of array_to_string.

> Or we could stick to the current behavior and say "use COALESCE() to
> resolve the ambiguity, if you need to".
>
>
Currently string_to_array(null, ',') yields a null result -
indistinguishable from string_to_array('',','). Wrapping in coalesce
does not help distinguish true null input from empty-string input. I'm
not sure at the moment what other cases exist where non-null input
generates null output.

If the decision is to leave the behavior unchanged, it at least cries
out for a documentation patch.

Cheers,
Steve


В списке pgsql-general по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: [HACKERS] string_to_array with empty input
Следующее
От: "Leif B. Kristensen"
Дата:
Сообщение: Re: [HACKERS] string_to_array with empty input