pg_enum
A system table storing information about ENUM types
pg_enum
is a system catalogue table storing information about ENUM types.
pg_enum
was added in PostgreSQL 8.3.
Definition by PostgreSQL version
pg_enum (PostgreSQL 15)
Table "pg_catalog.pg_enum" Column | Type | Collation | Nullable | Default ---------------+------+-----------+----------+--------- oid | oid | | not null | enumtypid | oid | | not null | enumsortorder | real | | not null | enumlabel | name | | not null | Indexes: "pg_enum_oid_index" PRIMARY KEY, btree (oid) "pg_enum_typid_label_index" UNIQUE CONSTRAINT, btree (enumtypid, enumlabel) "pg_enum_typid_sortorder_index" UNIQUE CONSTRAINT, btree (enumtypid, enumsortorder)
Documentation: pg_enum
pg_enum (PostgreSQL 14)
Table "pg_catalog.pg_enum" Column | Type | Collation | Nullable | Default ---------------+------+-----------+----------+--------- oid | oid | | not null | enumtypid | oid | | not null | enumsortorder | real | | not null | enumlabel | name | | not null | Indexes: "pg_enum_oid_index" PRIMARY KEY, btree (oid) "pg_enum_typid_label_index" UNIQUE CONSTRAINT, btree (enumtypid, enumlabel) "pg_enum_typid_sortorder_index" UNIQUE CONSTRAINT, btree (enumtypid, enumsortorder)
Documentation: pg_enum
pg_enum (PostgreSQL 13)
Table "pg_catalog.pg_enum" Column | Type | Collation | Nullable | Default ---------------+------+-----------+----------+--------- oid | oid | | not null | enumtypid | oid | | not null | enumsortorder | real | | not null | enumlabel | name | | not null | Indexes: "pg_enum_oid_index" UNIQUE, btree (oid) "pg_enum_typid_label_index" UNIQUE, btree (enumtypid, enumlabel) "pg_enum_typid_sortorder_index" UNIQUE, btree (enumtypid, enumsortorder)
Documentation: pg_enum
pg_enum (PostgreSQL 12)
Table "pg_catalog.pg_enum" Column | Type | Collation | Nullable | Default ---------------+------+-----------+----------+--------- oid | oid | | not null | enumtypid | oid | | not null | enumsortorder | real | | not null | enumlabel | name | | not null | Indexes: "pg_enum_oid_index" UNIQUE, btree (oid) "pg_enum_typid_label_index" UNIQUE, btree (enumtypid, enumlabel) "pg_enum_typid_sortorder_index" UNIQUE, btree (enumtypid, enumsortorder)
Documentation: pg_enum
pg_enum (PostgreSQL 11)
Table "pg_catalog.pg_enum" Column | Type | Collation | Nullable | Default ---------------+------+-----------+----------+--------- enumtypid | oid | | not null | enumsortorder | real | | not null | enumlabel | name | | not null | Indexes: "pg_enum_oid_index" UNIQUE, btree (oid) "pg_enum_typid_label_index" UNIQUE, btree (enumtypid, enumlabel) "pg_enum_typid_sortorder_index" UNIQUE, btree (enumtypid, enumsortorder)
Documentation: pg_enum
pg_enum (PostgreSQL 10)
Table "pg_catalog.pg_enum" Column | Type | Collation | Nullable | Default ---------------+------+-----------+----------+--------- enumtypid | oid | | not null | enumsortorder | real | | not null | enumlabel | name | | not null | Indexes: "pg_enum_oid_index" UNIQUE, btree (oid) "pg_enum_typid_label_index" UNIQUE, btree (enumtypid, enumlabel) "pg_enum_typid_sortorder_index" UNIQUE, btree (enumtypid, enumsortorder)
Documentation: pg_enum
pg_enum (PostgreSQL 9.6)
Table "pg_catalog.pg_enum" Column | Type | Modifiers ---------------+------+----------- enumtypid | oid | not null enumsortorder | real | not null enumlabel | name | not null Indexes: "pg_enum_oid_index" UNIQUE, btree (oid) "pg_enum_typid_label_index" UNIQUE, btree (enumtypid, enumlabel) "pg_enum_typid_sortorder_index" UNIQUE, btree (enumtypid, enumsortorder)
Documentation: pg_enum
pg_enum (PostgreSQL 9.5)
Table "pg_catalog.pg_enum" Column | Type | Modifiers ---------------+------+----------- enumtypid | oid | not null enumsortorder | real | not null enumlabel | name | not null Indexes: "pg_enum_oid_index" UNIQUE, btree (oid) "pg_enum_typid_label_index" UNIQUE, btree (enumtypid, enumlabel) "pg_enum_typid_sortorder_index" UNIQUE, btree (enumtypid, enumsortorder)
Documentation: pg_enum
pg_enum (PostgreSQL 9.4)
Table "pg_catalog.pg_enum" Column | Type | Modifiers ---------------+------+----------- enumtypid | oid | not null enumsortorder | real | not null enumlabel | name | not null Indexes: "pg_enum_oid_index" UNIQUE, btree (oid) "pg_enum_typid_label_index" UNIQUE, btree (enumtypid, enumlabel) "pg_enum_typid_sortorder_index" UNIQUE, btree (enumtypid, enumsortorder)
Documentation: pg_enum
pg_enum (PostgreSQL 9.3)
Table "pg_catalog.pg_enum" Column | Type | Modifiers ---------------+------+----------- enumtypid | oid | not null enumsortorder | real | not null enumlabel | name | not null Indexes: "pg_enum_oid_index" UNIQUE, btree (oid) "pg_enum_typid_label_index" UNIQUE, btree (enumtypid, enumlabel) "pg_enum_typid_sortorder_index" UNIQUE, btree (enumtypid, enumsortorder)
Documentation: pg_enum
pg_enum (PostgreSQL 9.2)
Table "pg_catalog.pg_enum" Column | Type | Modifiers ---------------+------+----------- enumtypid | oid | not null enumsortorder | real | not null enumlabel | name | not null Indexes: "pg_enum_oid_index" UNIQUE, btree (oid) "pg_enum_typid_label_index" UNIQUE, btree (enumtypid, enumlabel) "pg_enum_typid_sortorder_index" UNIQUE, btree (enumtypid, enumsortorder)
Documentation: pg_enum
pg_enum (PostgreSQL 9.1)
Table "pg_catalog.pg_enum" Column | Type | Modifiers ---------------+------+----------- enumtypid | oid | not null enumsortorder | real | not null enumlabel | name | not null Indexes: "pg_enum_oid_index" UNIQUE, btree (oid) "pg_enum_typid_label_index" UNIQUE, btree (enumtypid, enumlabel) "pg_enum_typid_sortorder_index" UNIQUE, btree (enumtypid, enumsortorder)
Documentation: pg_enum
pg_enum (PostgreSQL 9.0)
Table "pg_catalog.pg_enum" Column | Type | Modifiers -----------+------+----------- enumtypid | oid | not null enumlabel | name | not null Indexes: "pg_enum_oid_index" UNIQUE, btree (oid) "pg_enum_typid_label_index" UNIQUE, btree (enumtypid, enumlabel)
Documentation: pg_enum
pg_enum (PostgreSQL 8.4)
Table "pg_catalog.pg_enum" Column | Type | Modifiers -----------+------+----------- enumtypid | oid | not null enumlabel | name | not null Indexes: "pg_enum_oid_index" UNIQUE, btree (oid) "pg_enum_typid_label_index" UNIQUE, btree (enumtypid, enumlabel)
Documentation: pg_enum
pg_enum (PostgreSQL 8.3)
Table "pg_catalog.pg_enum" Column | Type | Modifiers -----------+------+----------- enumtypid | oid | not null enumlabel | name | not null Indexes: "pg_enum_oid_index" UNIQUE, btree (oid) "pg_enum_typid_label_index" UNIQUE, btree (enumtypid, enumlabel)
Documentation: pg_enum
Change history
- PostgreSQL 9.1
- column
enumsortorder
added (commit 84c123be)
- column
- PostgreSQL 8.3
- added (commit 57690c68)
Examples
postgres=# CREATE TYPE foobar AS ENUM ('foo', 'bar', 'baz'); CREATE TYPE postgres=# SELECT * FROM pg_enum ; oid | enumtypid | enumsortorder | enumlabel -------+-----------+---------------+----------- 16458 | 16456 | 1 | foo 16460 | 16456 | 2 | bar 16462 | 16456 | 3 | baz (3 rows)
References
- PostgreSQL documentation: pg_enum