pg_type
A system table which stores information about data types
pg_type
is a system catalogue table which stores information about data types.
pg_type
has always been present in PostgreSQL.
Definition by PostgreSQL version
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)
Documentation: 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)
Documentation: 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)
Documentation: 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)
Documentation: 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)
Documentation: 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)
Documentation: 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)
Documentation: 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)
Documentation: 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)
Documentation: 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)
Documentation: 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)
Documentation: 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)
Documentation: 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)
Documentation: 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)
Documentation: 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)
Documentation: pg_type
Change history
Work-in-progress
- PostgreSQL 14
- PostgreSQL 7.3
- following columns removed (commit 739adf32):
typprtlen
typreceive
typsend
- following columns removed (commit 739adf32):
Source code
Between PostgreSQL 8.4 (commit 039dfbfd) and PostgreSQL 11 (commit cefa3871), an additional source file src/include/catalog/pg_type_fn.h existed to enable catalogue definitions to be included by frontend code.
References
- PostgreSQL documentation: pg_type