pg_enum

存储有关 ENUM 类型的信息的系统表

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

更改历史记录

示例

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)

分类

数据类型, 系统目录

另请参阅

ENUM

反馈

提交您对 "pg_enum" 的任何评论、建议或更正 此处