Re: Getting list of supported types in Postgres

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Ivan Radovanovic <radovanovic(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Getting list of supported types in Postgres
Date: 2013-08-14 21:00:34
Message-ID: 20130814210034.GB7101@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Aug 14, 2013 at 02:17:26PM +0200, Ivan Radovanovic wrote:
> Hi guys,
>
> I am looking for a way to get list of supported types in Postgres
> together with information whether type can have optional size (like
> varchar for example), whether it can have precision (like decimal
> for example), and whether it can come as value of sequence (like all
> integer types for example), but I have trouble getting that info
> from pg_type table. This is SQL I was using:
>
> select
> pg_catalog.format_type(oid, null),
> *
> from
> pg_type
> where
> typnamespace = (select oid from pg_namespace where
> nspname='pg_catalog') and
> typisdefined and
> typname not like '$_%' escape '$' and
> typname not like 'pg%' and
> typtype = 'b'
> order by
> typname
>
> apparently pg_catalog.format_type for some types return quoted name
> ("char" for example), also I can't find decimal in results (there is
> numeric, but I would like to have complete list of supported types,
> so decimal should be included too). In documentation it is said that
> typlen of -1 or -2 means that type is variable length, but I don't
> know how to find out if type can have additional precision?

Try psql -E, and run the \dT command to see the query it uses.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ It's impossible for everything to be true. +

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Robert James 2013-08-15 00:15:43 Re: What type of index do I need for this JOIN?
Previous Message Tom Lane 2013-08-14 20:12:18 Re: Seemingly inconsistent ORDER BY behavior