Reputation: 31109
I can get enums, but I don't know how to filter it by database.
SELECT * FROM pg_catalog.pg_type t WHERE t.typtype = 'e';
That is the question — how to filter enums by database?
Upvotes: 0
Views: 399
Reputation: 324415
pg_catalog.pg_type
is not a shared catalog. It's per-database. So by definition, if a row appears in pg_type
it's in the database you are currently connected to.
The schema ("namespace") it's in is defined by the typnamespace
column, which you can join to pg_catalog.pg_namespace.oid
e.g.
select typname, nspname
from pg_type
inner join pg_namespace on pg_type.typnamespace = pg_namespace.oid
where nspname = 'public';
Upvotes: 2