pg_enum
是一个存储有关 ENUM 类型的 系统目录 表。
pg_enum
添加于 PostgreSQL 8.3。
按 PostgreSQL 版本定义
pg_enum (PostgreSQL 17)
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)
文档: pg_enum
pg_enum (PostgreSQL 16)
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)
文档: pg_enum
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)
文档: 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)
文档: 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)
文档: 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)
文档: 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)
文档: 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)
文档: 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)
文档: 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)
文档: 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)
文档: 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)
文档: 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)
文档: 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)
文档: 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)
文档: 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)
文档: 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)
文档: pg_enum
更改历史记录
- PostgreSQL 9.1
- 添加了列
enumsortorder
(提交 84c123be)
- 添加了列
- PostgreSQL 8.3
- 添加 (提交 57690c68)
示例
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)
参考文献
- PostgreSQL 文档: pg_enum