Re: string_to_array with an empty input string

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: string_to_array with an empty input string
Дата
Msg-id 7639.1281544612@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: string_to_array with an empty input string  ("David E. Wheeler" <david@kineticode.com>)
Ответы Re: string_to_array with an empty input string  (Robert Haas <robertmhaas@gmail.com>)
Re: string_to_array with an empty input string  ("David E. Wheeler" <david@kineticode.com>)
Список pgsql-hackers
"David E. Wheeler" <david@kineticode.com> writes:
> On Aug 11, 2010, at 7:41 AM, Tom Lane wrote:
>> So maybe we need to revisit the issue.  Pavel was claiming that
>> switching to a zero-element array result was a no-brainer, but evidently
>> it isn't so.  Is anybody still excited about the alternatives?

> % perl -E 'say q{"}, join(",", ""), q{"}'
> ""
> % ruby -e 'puts %q{"} + [""].join(",") + %q{"}'
> ""
> % python -c 'print "\"" + ",".join([""]) + "\""'
> ""

> I believe those are all "", rather than '"' + undef + '"'.

If you believe my previous opinion that the design center for these
functions is arrays of numbers, then a zero-entry text[] array is what
you want, because you can successfully cast it to a zero-entry array of
integers or floats or whatever.  Returning a single empty string will
make those cases fail.  So at the moment I'm on the side of the fence
that says zero-entry array is the best answer.
        regards, tom lane


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: review: psql: edit function, show function commands patch
Следующее
От: Robert Haas
Дата:
Сообщение: Re: review: psql: edit function, show function commands patch