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 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers