From: | "David E(dot) Wheeler" <david(at)kineticode(dot)com> |
---|---|
To: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Format Typmod? |
Date: | 2009-12-04 01:40:09 |
Message-ID: | 4D34B4E6-E2CD-4D60-A607-65599BEC9D42@kineticode.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hey Hackers,
I just had reason to want the way that format_type converts type names (e.g., varchar => character varying) in pgTAP, but didn't want the namespace qualification (used by format_type() when the type in question is not visible). I figured out that I could get that conversion by simply casting the OID argument to regtype, but then to get the typmod, I still have to use format_type() like so:
CREATE OR REPLACE FUNCTION display_type ( OID, INTEGER )
RETURNS TEXT AS $$
SELECT $1::regtype || COALESCE(
substring(pg_catalog.format_type($1, $2), '[(][^)]+[)]$'),
'')
$$ LANGUAGE SQL;
Is there a saner way to do it than this? That is, is there a better way to get the typmod than by munging the value returned by format_type()?
Thanks,
David
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2009-12-04 02:26:33 | Re: operator exclusion constraints |
Previous Message | David E. Wheeler | 2009-12-04 00:53:47 | Re: First feature patch for plperl - draft [PATCH] |