Re: to_typemod(type_name) information function

From: Sophie Herold <sophie_h(at)hemio(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: to_typemod(type_name) information function
Date: 2017-11-21 17:23:43
Message-ID: 47f80325-30f9-d0cf-17a0-55986579d9d5@hemio.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

the following patch allows to retrieve the typemod. Without this patch,
it does not seem to be possible to generate the first column.

SELECT format_type(to_regtype(t), pg_to_typemod(t)),
format_type(to_regtype(t), NULL)
FROM (VALUES
('INTERVAL SECOND (5)'),
('Varchar(17)'),
('timestamptz (2)')) AS x(t);
format_type | format_type
-----------------------------+--------------------------
interval second(5) | interval
character varying(17) | character varying
timestamp(2) with time zone | timestamp with time zone

I did not find any advice on how to choose a new OID for pg_proc.

Best,
Sophie

Attachment Content-Type Size
pg_to_typemod_v1.patch text/x-patch 4.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2017-11-21 17:28:03 Re: to_typemod(type_name) information function
Previous Message Tom Lane 2017-11-21 17:05:44 Re: View with duplicate GROUP BY entries