PostgreSQL 系统表pg_enum
发布时间:2020-12-13 17:20:17 所属栏目:百科 来源:网络整理
导读:pg_enum表包含显示每个枚举类型值和标签的记录。 名字 类型 引用 描述 oid oid 行标识符(隐藏属性; 必须明确选择) enumtypid oid pg_type.oid 拥有这个枚举值的pg_type记录的OID enumsortorder float4 这个枚举值在它的枚举类型中的排序位置 enumlabel name
pg_enum表包含显示每个枚举类型值和标签的记录。
postgres=# select * from pg_enum ;
(No rows)
可以看到系统表此时还没有枚举类型,我们可以自己定义一个枚举类型。 postgres=# create type mood as enum('sad','ok','happy');
CREATE TYPE postgres= postgres=# select * from pg_enum ;
enumtypid | enumsortorder | enumlabel
-----------+---------------+-----------
65750 | 1 | sad
65750 | 2 | ok
65750 | 3 | happy
(3 rows)
enumtypid是对应表pg_type的oid,因为它也是一中可以使用的数据类型。 postgres=# select * from pg_type where oid=65750 ;
-[ RECORD 1 ]--+----------
typname | mood
typnamespace | 2200
typowner | 10
typlen | 4
typbyval | t
typtype | e
typcategory | E
typispreferred | f
typisdefined | t
typdelim |,
typrelid | 0
typelem | 0
typarray | 65749
typinput | enum_in
typoutput | enum_out
typreceive | enum_recv
typsend | enum_send
typmodin | -
typmodout | -
typanalyze | -
typalign | i
typstorage | p
typnotnull | f
typbasetype | 0
typtypmod | -1
typndims | 0
typcollation | 0
typdefaultbin |
typdefault |
typacl |
typname是我们定义的mood。
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |