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)
Список
Дерево обсуждения
Duplicates being removed from intarray on subtraction of another intarray PG Doc comments form <noreply@postgresql.org>
Re: Duplicates being removed from intarray on subtraction of another intarray Laurenz Albe <laurenz.albe@cybertec.at>
Re: Duplicates being removed from intarray on subtraction of another intarray Erik Wienhold <ewie@ewie.name>
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 по дате отправления
От: Erik Wienhold
Дата: