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

2021-08-30 Thread Pól Ua Laoínecháin
Hi all and apologies for the simple question! > I want to "feed" the result of a query into your function - is there > something special I have to do for this? SELECT ARRAY_DUPS ( ( SELECT ARRAY[1,3,4,1, 5,6,5, 67] ) ) AS t; answer: t {1,5} And I can also feed in queries.

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

2021-08-30 Thread Pól Ua Laoínecháin
Hi Hubert, and thanks for your input! > > I was just wondering if there is some (already written) function out > > there that will drop this functionality into my lap? > #v+ > create function array_dups(ANYARRAY) returns ANYARRAY as $$ > select array( select i from unnest($1) i group by i hav

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

2021-08-30 Thread hubert depesz lubaczewski
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