Re: Duplicates being removed from intarray on subtraction of another intarray

Поиск
Список
Период
Сортировка
От Laurenz Albe
Тема Re: Duplicates being removed from intarray on subtraction of another intarray
Дата
Msg-id 396e990fa8ae32bf5c1e3bf2473778e6e296fbfe.camel@cybertec.at
обсуждение исходный текст
Ответ на Duplicates being removed from intarray on subtraction of another intarray  (PG Doc comments form <noreply@postgresql.org>)
Список pgsql-docs
On Mon, 2024-03-18 at 08:21 +0000, PG Doc comments form wrote:
> Page: https://www.postgresql.org/docs/16/intarray.html
>
> Hi,
> I recently ran into an unusual issue with the intarray extension where if
> you subtract one array from another the result is *also* sorted and
> de-duplicated. The documentation does not seem to imply that this should be
> the case, stating only that the operator "removes elements of the right
> array from the left array" and not that it also de-duplicates and sorts the
> result... It seems to only occur when subtracting an array. Is this the
> intended behavior?
>
> SELECT '{3,1,1,2,2,2}'::int[] - 1; --> {3,2,2,2} as you would expect
> SELECT '{3,1,1,2,2,2}'::int[] - '{1}'::int[]; --> {2,3} instead of
> {3,2,2,2}

There is no harm in documenting that; I propose the attached patch.

Yours,
Laurenz Albe

Вложения

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

Предыдущее
От: Laurenz Albe
Дата:
Сообщение: Re: Discourage splitting pg_wal directory
Следующее
От: Erik Wienhold
Дата:
Сообщение: Re: Duplicates being removed from intarray on subtraction of another intarray