Skip site navigation (1) Skip section navigation (2)

how to find details of a domain type?

From: "Jean-Yves F(dot) Barbier" <12ukwn(at)gmail(dot)com>
To: "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: how to find details of a domain type?
Date: 2011-11-07 22:20:04
Message-ID: 20111107232004.163da7b5@anubis.defcon1 (view raw or flat)
Thread:
Lists: pgsql-novice
Hi list,

I've a function:

SELECT D.typname as domname, format_type(b.oid,NULL) as dombasetype,  
    D.typlen, D.typtypmod, D.typnotnull, D.typdefault, D.typndims, D.typdelim, C.consrc 
    FROM pg_type D
    JOIN pg_type B ON B.oid = CASE WHEN B.typndims > 0 then D.typelem ELSE D.typbasetype END
    JOIN pg_namespace N ON N.oid = B.typnamespace
    JOIN pg_constraint C ON (D.typname || '_check') = C.conname 
    WHERE D.typtype = 'd' AND D.typnamespace = 2200::oid ORDER BY D.typname;

that returns (not complete):

domain name    | domain type | length(+typlen) | not null? | default  | constraint
dn_percent_vat | numeric     |          458762 | t         | 0.196000 | ((VALUE > -0.000001) AND (VALUE < 1.000001))

As 'length(+typlen)' returns 20 for 'varchar(16)', and min length of type
'character varying' is 4, 20-4=16 check ok.

However, I don't see how to extract 'numeric(7, 6)' from '458762' (IF it
should be extract from that value!)

How can I do that?

JY
-- 
Here's to women.  Would that we could fall into her arms without falling
into her hands. -- Ambrose Bierce

Responses

pgsql-novice by date

Next:From: Jean-Yves F. BarbierDate: 2011-11-08 03:39:15
Subject: Re: how to find details of a domain type? - [SOLVED]
Previous:From: Tom LaneDate: 2011-11-07 18:17:44
Subject: Re: complete uninstall of postgres 9.0.4

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group