views:

219

answers:

1

Postgresql got enum support some time ago.

CREATE TYPE myenum AS ENUM (
'value1',
'value2',
);

How do I get all values specified in the enum with a query?

+2  A: 

Try:

SELECT e.enumlabel
  FROM pg_enum e
  JOIN pg_type t ON e.enumtypid = t.oid
  WHERE t.typname = 'myenum'
Kev
If you have the same enum in more than one schema, this might need to be narrowed down a bit. If that's the case, see http://www.postgresql.org/docs/current/static/catalog-pg-type.html for details.
Kev