Oto Shavadze
Oto Shavadze

Reputation: 42773

See all built-in general-purpose data types

How to see all the built-in general-purpose data types, which support postgresql? For example from phppgadmin is possible to browse all types, but how to get types list via query, something like this:

 SELECT data_types from ....

Upvotes: 0

Views: 50

Answers (1)

user330315
user330315

Reputation:

Something like this:

select ns.nspname as schema_name, t.typname as type_name
from pg_type t
  join pg_namespace ns on ns.oid = t.typnamespace
where t.typtype in ('b')
  and t.typelem = 0;

pg_type contains an entry for each and every type in the database, that includes the composite type that is created for a table and so on. The above query tries to filter out those that might not be interesting for you. You will have to play around with it to make it fit your needs.

pg_type is documented in the manual: http://www.postgresql.org/docs/current/static/catalog-pg-type.html

Upvotes: 2

Related Questions