Re: ARRAY[1] || NULL <> array_append(ARRAY[1], NULL)

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: ARRAY[1] || NULL <> array_append(ARRAY[1], NULL)
Дата
Msg-id 32402.1436450457@sss.pgh.pa.us
обсуждение исходный текст
Ответ на ARRAY[1] || NULL <> array_append(ARRAY[1], NULL)  (Michael Herold <quabla@hemio.de>)
Ответы Re: ARRAY[1] || NULL <> array_append(ARRAY[1], NULL)  (Michael Herold <quabla@hemio.de>)
Re: ARRAY[1] || NULL <> array_append(ARRAY[1], NULL)  (Michael Herold <quabla@hemio.de>)
Список pgsql-docs
Michael Herold <quabla@hemio.de> writes:
> A few minutes ago I got bitten by the following PostgreSQL (9.4) behavior
> SELECT ARRAY[1] || NULL, array_append(ARRAY[1], NULL);
>   ?column? | array_append
> ----------+--------------
>   {1}      | {1,NULL}

> I expected that array_append and || are equivalent in this case but
> obviously they are not.

Yeah, the first case turns out to be array_cat not array_append.

> Sure, this is not too surprising since "||" has
> to guess which operation is appropriate. However, I would have highly
> appreciated ARRAY[1,2] || NULL as an example in [Table 9-45].

Hm.  I don't think there is really room for such an example in that table,
and certainly not room for a discursive discussion.  What would make more
sense to me is to add a paragraph and example concerning this issue at the
bottom of section 8.15.4, right after array_append and array_cat are
introduced.  Since there's already a pointer to 8.15 just below that
table, people would hopefully find the example from that vicinity as well.

Seem reasonable?

            regards, tom lane


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

Предыдущее
От: Michael Herold
Дата:
Сообщение: ARRAY[1] || NULL <> array_append(ARRAY[1], NULL)
Следующее
От: amul sul
Дата:
Сообщение: typo in synchronous_commit description