Re: [HACKERS] string_to_array with empty input

Поиск
Список
Период
Сортировка
От Steve Crawford
Тема Re: [HACKERS] string_to_array with empty input
Дата
Msg-id 49DB6C4C.3070004@pinpointresearch.com
обсуждение исходный текст
Ответ на Re: [HACKERS] string_to_array with empty input  (Robert Haas <robertmhaas@gmail.com>)
Ответы Re: [HACKERS] string_to_array with empty input  (justin <justin@emproshunts.com>)
Re: [HACKERS] string_to_array with empty input  ("David E. Wheeler" <david@kineticode.com>)
Список pgsql-general
Did I miss the exciting conclusion or did this drift silently off radar?

I seem to recall three options:

1. Leave as is. Arguments: least effort, no backward compatibility
issues, since array_to_string evaluate both an array with single empty
string and an array with no elements to an empty string, string_to_array
on empty strings is ambiguous so we'll call it null. But: means that the
result of null input and non-null empty-string both result in null
output, requires everyone to explicitly handle empty strings (with the
side effect that they really know what the result will be) instead of
"helping" the majority of users. Requires: documentation change to
accurately describe function's behavior.

2. Change function to return an array. Arguments: Distinguishes null
from non-null input, easier coding for most cases, perhaps a less
surprising result. But: not backward compatible, requires somewhat
arbitrary decision on correct return value. Requires: code
change/testing, documentation updates.

In scenario 2, there were two options:
2a. Return zero-element array.
2b. Return array with single empty-string element.

My impression was that among the "change" options, 2b had the most
support (it is the most useful for the use-cases I've encountered so it
gets my vote). If the consensus is to change the function, it may be too
late for 8.4. But the documentation could be updated to reflect current
and planned behavior.

Cheers,
Steve


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: bug in 8.4 pg_dumpall ?
Следующее
От: justin
Дата:
Сообщение: Re: [HACKERS] string_to_array with empty input