Ich bevorzuge diese Syntax (etwa 5 % schneller):
create or replace function public.array_unique(arr anyarray) returns anyarray as $body$ select array( select distinct unnest($1) ) $body$ language 'sql';
Verwendung:
select array_unique(ARRAY['1','2','3','4','4']);