Re: Arrays - selecting (and not removing) duplicates...

Поиск
Список
Период
Сортировка
От hubert depesz lubaczewski
Тема Re: Arrays - selecting (and not removing) duplicates...
Дата
Msg-id 20210830135446.GB14443@depesz.com
обсуждение исходный текст
Ответ на Arrays - selecting (and not removing) duplicates...  (Pól Ua Laoínecháin <linehanp@tcd.ie>)
Ответы Re: Arrays - selecting (and not removing) duplicates...  (Pól Ua Laoínecháin <linehanp@tcd.ie>)
Список pgsql-general
On Mon, Aug 30, 2021 at 01:47:19PM +0100, Pól Ua Laoínecháin wrote:
> I was just wondering if there is some (already written) function out
> there that will drop this functionality into my lap?

Sure, here:

#v+
create function array_dups(ANYARRAY) returns ANYARRAY as $$
    select array( select i from unnest($1) i group by i having count(*) > 1 );
$$ language sql;
#v-

Best regards,

depesz




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

Предыдущее
От: hubert depesz lubaczewski
Дата:
Сообщение: Pg stuck at 100% cpu, for multiple days
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Can we get rid of repeated queries from pg_dump?