Re: to_typemod(type_name) information function - Mailing list pgsql-hackers

From Sophie Herold
Subject Re: to_typemod(type_name) information function
Date
Msg-id 47f80325-30f9-d0cf-17a0-55986579d9d5@hemio.de
Whole thread Raw
In response to Re: to_typemod(type_name) information function  (Sophie Herold <sophie_h@hemio.de>)
Responses Re: to_typemod(type_name) information function  (Stephen Frost <sfrost@snowman.net>)
Re: to_typemod(type_name) information function  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: to_typemod(type_name) information function  (Arthur Zakirov <a.zakirov@postgrespro.ru>)
List 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

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: View with duplicate GROUP BY entries
Next
From: Stephen Frost
Date:
Subject: Re: to_typemod(type_name) information function