Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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






[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux