Re: [GENERAL] string_to_array with empty input

Поиск
Список
Период
Сортировка
От David E. Wheeler
Тема Re: [GENERAL] string_to_array with empty input
Дата
Msg-id A92B4688-A246-41A5-91A4-033EA5FA2B7C@kineticode.com
обсуждение исходный текст
Ответ на Re: [GENERAL] string_to_array with empty input  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: [GENERAL] string_to_array with empty input  (Robert Haas <robertmhaas@gmail.com>)
Re: [GENERAL] string_to_array with empty input  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Apr 1, 2009, at 2:22 PM, Tom Lane wrote:

> Another way to state the point is that we can offer people a choice of
> two limitations: string_to_array doesn't work for zero-length lists,
> or string_to_array doesn't work for empty strings (except most of the
> time, it does).  The former is sounding less likely to bite people
> unexpectedly.

Right, very well put.

> Or we could stick to the current behavior and say "use COALESCE() to
> resolve the ambiguity, if you need to".

Steve has a point that leaving it as-is leaves it as impossible to
tell the difference between string_to_array(NULL, ',') and
string_to_array('', ','). The former properly handles an unknown
value, while the latter, where '' is a known value, seems weird to be
returning NULL.

Best,

David

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

Предыдущее
От: "David E. Wheeler"
Дата:
Сообщение: Re: [GENERAL] string_to_array with empty input
Следующее
От: Werner Echezuria
Дата:
Сообщение: Re: Sort a column that does not exist