pg_type
是一个存储数据类型信息的系统目录表。
pg_type
一直存在于 PostgreSQL 中。
按 PostgreSQL 版本定义
pg_type (PostgreSQL 17)
Table "pg_catalog.pg_type" Column | Type | Collation | Nullable | Default ----------------+--------------+-----------+----------+--------- oid | oid | | not null | typname | name | | not null | typnamespace | oid | | not null | typowner | oid | | not null | typlen | smallint | | not null | typbyval | boolean | | not null | typtype | "char" | | not null | typcategory | "char" | | not null | typispreferred | boolean | | not null | typisdefined | boolean | | not null | typdelim | "char" | | not null | typrelid | oid | | not null | typsubscript | regproc | | not null | typelem | oid | | not null | typarray | oid | | not null | typinput | regproc | | not null | typoutput | regproc | | not null | typreceive | regproc | | not null | typsend | regproc | | not null | typmodin | regproc | | not null | typmodout | regproc | | not null | typanalyze | regproc | | not null | typalign | "char" | | not null | typstorage | "char" | | not null | typnotnull | boolean | | not null | typbasetype | oid | | not null | typtypmod | integer | | not null | typndims | integer | | not null | typcollation | oid | | not null | typdefaultbin | pg_node_tree | C | | typdefault | text | C | | typacl | aclitem[] | | | Indexes: "pg_type_oid_index" PRIMARY KEY, btree (oid) "pg_type_typname_nsp_index" UNIQUE CONSTRAINT, btree (typname, typnamespace)
文档: pg_type
pg_type (PostgreSQL 16)
Table "pg_catalog.pg_type" Column | Type | Collation | Nullable | Default ----------------+--------------+-----------+----------+--------- oid | oid | | not null | typname | name | | not null | typnamespace | oid | | not null | typowner | oid | | not null | typlen | smallint | | not null | typbyval | boolean | | not null | typtype | "char" | | not null | typcategory | "char" | | not null | typispreferred | boolean | | not null | typisdefined | boolean | | not null | typdelim | "char" | | not null | typrelid | oid | | not null | typsubscript | regproc | | not null | typelem | oid | | not null | typarray | oid | | not null | typinput | regproc | | not null | typoutput | regproc | | not null | typreceive | regproc | | not null | typsend | regproc | | not null | typmodin | regproc | | not null | typmodout | regproc | | not null | typanalyze | regproc | | not null | typalign | "char" | | not null | typstorage | "char" | | not null | typnotnull | boolean | | not null | typbasetype | oid | | not null | typtypmod | integer | | not null | typndims | integer | | not null | typcollation | oid | | not null | typdefaultbin | pg_node_tree | C | | typdefault | text | C | | typacl | aclitem[] | | | Indexes: "pg_type_oid_index" PRIMARY KEY, btree (oid) "pg_type_typname_nsp_index" UNIQUE CONSTRAINT, btree (typname, typnamespace)
文档: pg_type
pg_type (PostgreSQL 15)
Table "pg_catalog.pg_type" Column | Type | Collation | Nullable | Default ----------------+--------------+-----------+----------+--------- oid | oid | | not null | typname | name | | not null | typnamespace | oid | | not null | typowner | oid | | not null | typlen | smallint | | not null | typbyval | boolean | | not null | typtype | "char" | | not null | typcategory | "char" | | not null | typispreferred | boolean | | not null | typisdefined | boolean | | not null | typdelim | "char" | | not null | typrelid | oid | | not null | typsubscript | regproc | | not null | typelem | oid | | not null | typarray | oid | | not null | typinput | regproc | | not null | typoutput | regproc | | not null | typreceive | regproc | | not null | typsend | regproc | | not null | typmodin | regproc | | not null | typmodout | regproc | | not null | typanalyze | regproc | | not null | typalign | "char" | | not null | typstorage | "char" | | not null | typnotnull | boolean | | not null | typbasetype | oid | | not null | typtypmod | integer | | not null | typndims | integer | | not null | typcollation | oid | | not null | typdefaultbin | pg_node_tree | C | | typdefault | text | C | | typacl | aclitem[] | | | Indexes: "pg_type_oid_index" PRIMARY KEY, btree (oid) "pg_type_typname_nsp_index" UNIQUE CONSTRAINT, btree (typname, typnamespace)
文档: pg_type
pg_type (PostgreSQL 14)
Table "pg_catalog.pg_type" Column | Type | Collation | Nullable | Default ----------------+--------------+-----------+----------+--------- oid | oid | | not null | typname | name | | not null | typnamespace | oid | | not null | typowner | oid | | not null | typlen | smallint | | not null | typbyval | boolean | | not null | typtype | "char" | | not null | typcategory | "char" | | not null | typispreferred | boolean | | not null | typisdefined | boolean | | not null | typdelim | "char" | | not null | typrelid | oid | | not null | typsubscript | regproc | | not null | typelem | oid | | not null | typarray | oid | | not null | typinput | regproc | | not null | typoutput | regproc | | not null | typreceive | regproc | | not null | typsend | regproc | | not null | typmodin | regproc | | not null | typmodout | regproc | | not null | typanalyze | regproc | | not null | typalign | "char" | | not null | typstorage | "char" | | not null | typnotnull | boolean | | not null | typbasetype | oid | | not null | typtypmod | integer | | not null | typndims | integer | | not null | typcollation | oid | | not null | typdefaultbin | pg_node_tree | C | | typdefault | text | C | | typacl | aclitem[] | | | Indexes: "pg_type_oid_index" PRIMARY KEY, btree (oid) "pg_type_typname_nsp_index" UNIQUE CONSTRAINT, btree (typname, typnamespace)
文档: pg_type
pg_type (PostgreSQL 13)
Table "pg_catalog.pg_type" Column | Type | Collation | Nullable | Default ----------------+--------------+-----------+----------+--------- oid | oid | | not null | typname | name | | not null | typnamespace | oid | | not null | typowner | oid | | not null | typlen | smallint | | not null | typbyval | boolean | | not null | typtype | "char" | | not null | typcategory | "char" | | not null | typispreferred | boolean | | not null | typisdefined | boolean | | not null | typdelim | "char" | | not null | typrelid | oid | | not null | typelem | oid | | not null | typarray | oid | | not null | typinput | regproc | | not null | typoutput | regproc | | not null | typreceive | regproc | | not null | typsend | regproc | | not null | typmodin | regproc | | not null | typmodout | regproc | | not null | typanalyze | regproc | | not null | typalign | "char" | | not null | typstorage | "char" | | not null | typnotnull | boolean | | not null | typbasetype | oid | | not null | typtypmod | integer | | not null | typndims | integer | | not null | typcollation | oid | | not null | typdefaultbin | pg_node_tree | C | | typdefault | text | C | | typacl | aclitem[] | | | Indexes: "pg_type_oid_index" UNIQUE, btree (oid) "pg_type_typname_nsp_index" UNIQUE, btree (typname, typnamespace)
文档: pg_type
pg_type (PostgreSQL 12)
Table "pg_catalog.pg_type" Column | Type | Collation | Nullable | Default ----------------+--------------+-----------+----------+--------- oid | oid | | not null | typname | name | | not null | typnamespace | oid | | not null | typowner | oid | | not null | typlen | smallint | | not null | typbyval | boolean | | not null | typtype | "char" | | not null | typcategory | "char" | | not null | typispreferred | boolean | | not null | typisdefined | boolean | | not null | typdelim | "char" | | not null | typrelid | oid | | not null | typelem | oid | | not null | typarray | oid | | not null | typinput | regproc | | not null | typoutput | regproc | | not null | typreceive | regproc | | not null | typsend | regproc | | not null | typmodin | regproc | | not null | typmodout | regproc | | not null | typanalyze | regproc | | not null | typalign | "char" | | not null | typstorage | "char" | | not null | typnotnull | boolean | | not null | typbasetype | oid | | not null | typtypmod | integer | | not null | typndims | integer | | not null | typcollation | oid | | not null | typdefaultbin | pg_node_tree | C | | typdefault | text | C | | typacl | aclitem[] | | | Indexes: "pg_type_oid_index" UNIQUE, btree (oid) "pg_type_typname_nsp_index" UNIQUE, btree (typname, typnamespace)
文档: pg_type
pg_type (PostgreSQL 11)
Table "pg_catalog.pg_type" Column | Type | Collation | Nullable | Default ----------------+--------------+-----------+----------+--------- typname | name | | not null | typnamespace | oid | | not null | typowner | oid | | not null | typlen | smallint | | not null | typbyval | boolean | | not null | typtype | "char" | | not null | typcategory | "char" | | not null | typispreferred | boolean | | not null | typisdefined | boolean | | not null | typdelim | "char" | | not null | typrelid | oid | | not null | typelem | oid | | not null | typarray | oid | | not null | typinput | regproc | | not null | typoutput | regproc | | not null | typreceive | regproc | | not null | typsend | regproc | | not null | typmodin | regproc | | not null | typmodout | regproc | | not null | typanalyze | regproc | | not null | typalign | "char" | | not null | typstorage | "char" | | not null | typnotnull | boolean | | not null | typbasetype | oid | | not null | typtypmod | integer | | not null | typndims | integer | | not null | typcollation | oid | | not null | typdefaultbin | pg_node_tree | | | typdefault | text | | | typacl | aclitem[] | | | Indexes: "pg_type_oid_index" UNIQUE, btree (oid) "pg_type_typname_nsp_index" UNIQUE, btree (typname, typnamespace)
文档: pg_type
pg_type (PostgreSQL 10)
Table "pg_catalog.pg_type" Column | Type | Collation | Nullable | Default ----------------+--------------+-----------+----------+--------- typname | name | | not null | typnamespace | oid | | not null | typowner | oid | | not null | typlen | smallint | | not null | typbyval | boolean | | not null | typtype | "char" | | not null | typcategory | "char" | | not null | typispreferred | boolean | | not null | typisdefined | boolean | | not null | typdelim | "char" | | not null | typrelid | oid | | not null | typelem | oid | | not null | typarray | oid | | not null | typinput | regproc | | not null | typoutput | regproc | | not null | typreceive | regproc | | not null | typsend | regproc | | not null | typmodin | regproc | | not null | typmodout | regproc | | not null | typanalyze | regproc | | not null | typalign | "char" | | not null | typstorage | "char" | | not null | typnotnull | boolean | | not null | typbasetype | oid | | not null | typtypmod | integer | | not null | typndims | integer | | not null | typcollation | oid | | not null | typdefaultbin | pg_node_tree | | | typdefault | text | | | typacl | aclitem[] | | | Indexes: "pg_type_oid_index" UNIQUE, btree (oid) "pg_type_typname_nsp_index" UNIQUE, btree (typname, typnamespace)
文档: pg_type
pg_type (PostgreSQL 9.6)
Table "pg_catalog.pg_type" Column | Type | Modifiers ----------------+--------------+----------- typname | name | not null typnamespace | oid | not null typowner | oid | not null typlen | smallint | not null typbyval | boolean | not null typtype | "char" | not null typcategory | "char" | not null typispreferred | boolean | not null typisdefined | boolean | not null typdelim | "char" | not null typrelid | oid | not null typelem | oid | not null typarray | oid | not null typinput | regproc | not null typoutput | regproc | not null typreceive | regproc | not null typsend | regproc | not null typmodin | regproc | not null typmodout | regproc | not null typanalyze | regproc | not null typalign | "char" | not null typstorage | "char" | not null typnotnull | boolean | not null typbasetype | oid | not null typtypmod | integer | not null typndims | integer | not null typcollation | oid | not null typdefaultbin | pg_node_tree | typdefault | text | typacl | aclitem[] | Indexes: "pg_type_oid_index" UNIQUE, btree (oid) "pg_type_typname_nsp_index" UNIQUE, btree (typname, typnamespace)
文档: pg_type
pg_type (PostgreSQL 9.5)
Table "pg_catalog.pg_type" Column | Type | Modifiers ----------------+--------------+----------- typname | name | not null typnamespace | oid | not null typowner | oid | not null typlen | smallint | not null typbyval | boolean | not null typtype | "char" | not null typcategory | "char" | not null typispreferred | boolean | not null typisdefined | boolean | not null typdelim | "char" | not null typrelid | oid | not null typelem | oid | not null typarray | oid | not null typinput | regproc | not null typoutput | regproc | not null typreceive | regproc | not null typsend | regproc | not null typmodin | regproc | not null typmodout | regproc | not null typanalyze | regproc | not null typalign | "char" | not null typstorage | "char" | not null typnotnull | boolean | not null typbasetype | oid | not null typtypmod | integer | not null typndims | integer | not null typcollation | oid | not null typdefaultbin | pg_node_tree | typdefault | text | typacl | aclitem[] | Indexes: "pg_type_oid_index" UNIQUE, btree (oid) "pg_type_typname_nsp_index" UNIQUE, btree (typname, typnamespace)
文档: pg_type
pg_type (PostgreSQL 9.4)
Table "pg_catalog.pg_type" Column | Type | Modifiers ----------------+--------------+----------- typname | name | not null typnamespace | oid | not null typowner | oid | not null typlen | smallint | not null typbyval | boolean | not null typtype | "char" | not null typcategory | "char" | not null typispreferred | boolean | not null typisdefined | boolean | not null typdelim | "char" | not null typrelid | oid | not null typelem | oid | not null typarray | oid | not null typinput | regproc | not null typoutput | regproc | not null typreceive | regproc | not null typsend | regproc | not null typmodin | regproc | not null typmodout | regproc | not null typanalyze | regproc | not null typalign | "char" | not null typstorage | "char" | not null typnotnull | boolean | not null typbasetype | oid | not null typtypmod | integer | not null typndims | integer | not null typcollation | oid | not null typdefaultbin | pg_node_tree | typdefault | text | typacl | aclitem[] | Indexes: "pg_type_oid_index" UNIQUE, btree (oid) "pg_type_typname_nsp_index" UNIQUE, btree (typname, typnamespace)
文档: pg_type
pg_type (PostgreSQL 9.3)
Table "pg_catalog.pg_type" Column | Type | Modifiers ----------------+--------------+----------- typname | name | not null typnamespace | oid | not null typowner | oid | not null typlen | smallint | not null typbyval | boolean | not null typtype | "char" | not null typcategory | "char" | not null typispreferred | boolean | not null typisdefined | boolean | not null typdelim | "char" | not null typrelid | oid | not null typelem | oid | not null typarray | oid | not null typinput | regproc | not null typoutput | regproc | not null typreceive | regproc | not null typsend | regproc | not null typmodin | regproc | not null typmodout | regproc | not null typanalyze | regproc | not null typalign | "char" | not null typstorage | "char" | not null typnotnull | boolean | not null typbasetype | oid | not null typtypmod | integer | not null typndims | integer | not null typcollation | oid | not null typdefaultbin | pg_node_tree | typdefault | text | typacl | aclitem[] | Indexes: "pg_type_oid_index" UNIQUE, btree (oid) "pg_type_typname_nsp_index" UNIQUE, btree (typname, typnamespace)
文档: pg_type
pg_type (PostgreSQL 9.2)
Table "pg_catalog.pg_type" Column | Type | Modifiers ----------------+--------------+----------- typname | name | not null typnamespace | oid | not null typowner | oid | not null typlen | smallint | not null typbyval | boolean | not null typtype | "char" | not null typcategory | "char" | not null typispreferred | boolean | not null typisdefined | boolean | not null typdelim | "char" | not null typrelid | oid | not null typelem | oid | not null typarray | oid | not null typinput | regproc | not null typoutput | regproc | not null typreceive | regproc | not null typsend | regproc | not null typmodin | regproc | not null typmodout | regproc | not null typanalyze | regproc | not null typalign | "char" | not null typstorage | "char" | not null typnotnull | boolean | not null typbasetype | oid | not null typtypmod | integer | not null typndims | integer | not null typcollation | oid | not null typdefaultbin | pg_node_tree | typdefault | text | typacl | aclitem[] | Indexes: "pg_type_oid_index" UNIQUE, btree (oid) "pg_type_typname_nsp_index" UNIQUE, btree (typname, typnamespace)
文档: pg_type
pg_type (PostgreSQL 9.1)
Table "pg_catalog.pg_type" Column | Type | Modifiers ----------------+--------------+----------- typname | name | not null typnamespace | oid | not null typowner | oid | not null typlen | smallint | not null typbyval | boolean | not null typtype | "char" | not null typcategory | "char" | not null typispreferred | boolean | not null typisdefined | boolean | not null typdelim | "char" | not null typrelid | oid | not null typelem | oid | not null typarray | oid | not null typinput | regproc | not null typoutput | regproc | not null typreceive | regproc | not null typsend | regproc | not null typmodin | regproc | not null typmodout | regproc | not null typanalyze | regproc | not null typalign | "char" | not null typstorage | "char" | not null typnotnull | boolean | not null typbasetype | oid | not null typtypmod | integer | not null typndims | integer | not null typcollation | oid | not null typdefaultbin | pg_node_tree | typdefault | text | Indexes: "pg_type_oid_index" UNIQUE, btree (oid) "pg_type_typname_nsp_index" UNIQUE, btree (typname, typnamespace)
文档: pg_type
pg_type (PostgreSQL 9.0)
Table "pg_catalog.pg_type" Column | Type | Modifiers ----------------+----------+----------- typname | name | not null typnamespace | oid | not null typowner | oid | not null typlen | smallint | not null typbyval | boolean | not null typtype | "char" | not null typcategory | "char" | not null typispreferred | boolean | not null typisdefined | boolean | not null typdelim | "char" | not null typrelid | oid | not null typelem | oid | not null typarray | oid | not null typinput | regproc | not null typoutput | regproc | not null typreceive | regproc | not null typsend | regproc | not null typmodin | regproc | not null typmodout | regproc | not null typanalyze | regproc | not null typalign | "char" | not null typstorage | "char" | not null typnotnull | boolean | not null typbasetype | oid | not null typtypmod | integer | not null typndims | integer | not null typdefaultbin | text | typdefault | text | Indexes: "pg_type_oid_index" UNIQUE, btree (oid) "pg_type_typname_nsp_index" UNIQUE, btree (typname, typnamespace)
文档: pg_type
pg_type (PostgreSQL 8.4)
Table "pg_catalog.pg_type" Column | Type | Modifiers ----------------+----------+----------- typname | name | not null typnamespace | oid | not null typowner | oid | not null typlen | smallint | not null typbyval | boolean | not null typtype | "char" | not null typcategory | "char" | not null typispreferred | boolean | not null typisdefined | boolean | not null typdelim | "char" | not null typrelid | oid | not null typelem | oid | not null typarray | oid | not null typinput | regproc | not null typoutput | regproc | not null typreceive | regproc | not null typsend | regproc | not null typmodin | regproc | not null typmodout | regproc | not null typanalyze | regproc | not null typalign | "char" | not null typstorage | "char" | not null typnotnull | boolean | not null typbasetype | oid | not null typtypmod | integer | not null typndims | integer | not null typdefaultbin | text | typdefault | text | Indexes: "pg_type_oid_index" UNIQUE, btree (oid) "pg_type_typname_nsp_index" UNIQUE, btree (typname, typnamespace)
文档: pg_type
pg_type (PostgreSQL 8.3)
Table "pg_catalog.pg_type" Column | Type | Modifiers ---------------+----------+----------- typname | name | not null typnamespace | oid | not null typowner | oid | not null typlen | smallint | not null typbyval | boolean | not null typtype | "char" | not null typisdefined | boolean | not null typdelim | "char" | not null typrelid | oid | not null typelem | oid | not null typarray | oid | not null typinput | regproc | not null typoutput | regproc | not null typreceive | regproc | not null typsend | regproc | not null typmodin | regproc | not null typmodout | regproc | not null typanalyze | regproc | not null typalign | "char" | not null typstorage | "char" | not null typnotnull | boolean | not null typbasetype | oid | not null typtypmod | integer | not null typndims | integer | not null typdefaultbin | text | typdefault | text | Indexes: "pg_type_oid_index" UNIQUE, btree (oid) "pg_type_typname_nsp_index" UNIQUE, btree (typname, typnamespace)
文档: pg_type
pg_type (PostgreSQL 8.2)
Table "pg_catalog.pg_type" Column | Type | Modifiers ---------------+----------+----------- typname | name | not null typnamespace | oid | not null typowner | oid | not null typlen | smallint | not null typbyval | boolean | not null typtype | "char" | not null typisdefined | boolean | not null typdelim | "char" | not null typrelid | oid | not null typelem | oid | not null typinput | regproc | not null typoutput | regproc | not null typreceive | regproc | not null typsend | regproc | not null typanalyze | regproc | not null typalign | "char" | not null typstorage | "char" | not null typnotnull | boolean | not null typbasetype | oid | not null typtypmod | integer | not null typndims | integer | not null typdefaultbin | text | typdefault | text | Indexes: "pg_type_oid_index" UNIQUE, btree (oid) "pg_type_typname_nsp_index" UNIQUE, btree (typname, typnamespace)
文档: pg_type
更改历史
开发中
- PostgreSQL 14
- PostgreSQL 9.1
- 添加列
typcollation
(提交 414c5a2e)
- 添加列
- PostgreSQL 8.4
- 添加列
typcategory
和typispreferred
(提交 bac3e836)
- 添加列
- PostgreSQL 8.3
- PostgreSQL 8.0
- 添加列
typanalyze
(提交 69946411)
- 添加列
- PostgreSQL 7.4
- 重新添加以下列 (提交 45d04099)
typreceive
typsend
- 重新添加以下列 (提交 45d04099)
- PostgreSQL 7.3
- 删除以下列 (提交 739adf32)
typprtlen
typreceive
typsend
- 删除以下列 (提交 739adf32)
源代码
在 PostgreSQL 8.4 (提交 039dfbfd) 和 PostgreSQL 11 (提交 cefa3871) 之间,存在一个额外的源文件 src/include/catalog/pg_type_fn.h,以允许前端代码包含目录定义。
参考文献
- PostgreSQL 文档: pg_type