Registering aggregate function for a custom domain

From: Lele Gaifax <lele(at)metapensiero(dot)it>
To: pgsql-general(at)postgresql(dot)org
Subject: Registering aggregate function for a custom domain
Date: 2017-07-10 21:52:55
Message-ID: 877ezgyn60.fsf@metapensiero.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi all,

I'm used to define data domains and use them to create my tables, something
like

CREATE DOMAIN id_t uuid;
CREATE DOMAIN text_t text;
CREATE mytable (id id_t, value text_t, PRIMARY KEY (id));

The only "annoyance" is that I cannot use some standard function:

SELECT array_agg(id) FROM mytable;
could not find array type for data type id_t

and I must cast the value to the underlying concrete data type, for example:

SELECT array_agg(id::uuid) FROM mytable;
{00000000-0000-0000-0000-000000000000,c72ca134-655b-11e7...

Is there a way to smooth my issue, registering a "compatible" array_agg() that
accepts the domain too?

Thanks in advance,
ciao, lele.
--
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
lele(at)metapensiero(dot)it | -- Fortunato Depero, 1929.

Browse pgsql-general by date

  From Date Subject
Next Message Stephen Frost 2017-07-10 22:59:27 Re: pg_start/stop_backup non-exclusive scripts to snapshot
Previous Message Zhu, Joshua 2017-07-10 21:49:02 Re: BDR node removal and rejoin