Re: patch: to_string, to_array functions

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема Re: patch: to_string, to_array functions
Дата
Msg-id AANLkTinDPnIN0EWsZupZ5wN-sin_a-IV1e0-WKm2sqPM@mail.gmail.com
обсуждение исходный текст
Ответ на Re: patch: to_string, to_array functions  (Robert Haas <robertmhaas@gmail.com>)
Ответы Re: patch: to_string, to_array functions  (Robert Haas <robertmhaas@gmail.com>)
Список pgsql-hackers
2010/7/21 Robert Haas <robertmhaas@gmail.com>:
> On Wed, Jul 21, 2010 at 12:39 AM, Itagaki Takahiro
> <itagaki.takahiro@gmail.com> wrote:
>> 2010/7/20 Pavel Stehule <pavel.stehule@gmail.com>:
>>> here is a new version - new these functions are not a strict and
>>> function to_string is marked as stable.
>>
>> We have array_to_string(anyarray, text) and string_to_array(text, text),
>> and you'll introduce to_string(anyarray, text, text) and
>> to_array(text, text, text).
>> Do we think it is good idea to have different names for them?  IMHO, we'd
>> better  use 3 arguments version of array_to_string() instead of the
>> new to_string() ?
>
> The worst part is that the new names are not very mnemonic.
>
> I think maybe what we really need here is array equivalents of
> COALESCE() and NULLIF().  It looks like the proposed to_string()
> function is basically equivalent to replacing each NULL entry with the
> array with a given value, and then doing array_to_string() as usual.
> And it looks like the proposed to_array function basically does the
> same thing as to_array(), and then replaces empty strings with NULL or
> some other value.
>
> Maybe we just need a function array_replace(anyarray, anyelement,
> anyelement) that replaces any element in the array that IS NOT
> DISTINCT FROM $2 with $3 and returns the new array.  That could be
> useful for other things besides this particular case, too.
>

I don't agree. Building or updating any array is little bit expensive.
There can be same performance issue like combination array_agg and
array_to_string versus string_agg. I am not against to possible name
changes. But I am strong in opinion so current string_to_array and
array_to_string are buggy and have to be deprecated.

Regards

Pavel

p.s. can we use a names - text_to_array, array_to_text ?


> --
> Robert Haas
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise Postgres Company
>


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

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: patch: to_string, to_array functions
Следующее
От: Abhijit Menon-Sen
Дата:
Сообщение: Re: managing git disk space usage