pg_type

The pg_type catalog provides information about data types.

Column name Data type Description
oid oid A row identifier.
typname name A data type name.
typnamespace oid (references pg_namespace.oid) The OID of the namespace that contains this type.
typowner oid (references pg_authid.oid) The OID of the role that owns the type.
typlen int2 For fixed-size types, the number of bytes in the internal representation.
Negative values are used for variable-length types. The possible values are:
  • -1 – A varlena.
  • -2 – A NULL-terminated C string.
typbyval bool Specifies whether internal routines pass a value by value (TRUE) or by reference (FALSE).
typtype char A type kind.
The possible values are:
  • b – Base.
  • c – Composite.
  • d – Domain.
  • e – Enum.
  • p – Pseudo.
  • r – Range.
  • m – Multirange.
typcategory char An arbitrary classification used by the parser to determine preferred casts.
typispreferred bool Specifies whether the type is a preferred cast target within its typcategory (TRUE) or not (FALSE).
typisdefined bool Specifies whether the type is defined (TRUE), or it is a placeholder for a not-yet-defined type (FALSE).
typdelim char A character that separates values of this type when parsing an array input.
typrelid oid (references pg_class.oid) For composite types, points to the pg_class entry defining the corresponding table.
0 – Non-composite types.
typsubscript regproc (references pg_proc.oid) The OID of the subscripting handler function.
0 – Not supported.
typelem oid (references pg_type.oid) Specifies the element type for subscripting.
0 – Not applicable.
typarray oid (references pg_type.oid) Specifies the array type having this type as element.
typinput regproc (references pg_proc.oid) An input conversion function (text format).
typoutput regproc (references pg_proc.oid) An output conversion function (text format).
typreceive regproc (references pg_proc.oid) A binary input conversion function.
0 – None.
typsend regproc (references pg_proc.oid) An output conversion function, in the binary format.
0 – None.
typmodin regproc (references pg_proc.oid) A type modifier input function.
0 – Not supported.
typmodout regproc (references pg_proc.oid) A type modifier output function.
0 – A standard format is used.
typanalyze regproc (references pg_proc.oid) The custom ANALYZE function.
0 – A standard function is used.
typalign char The alignment required when storing a value.
The possible values are:
  • c – Char.
  • s – Short.
  • i – Int.
  • d – Double.
typstorage char A storage strategy for varlena types.
The possible values are:
  • p – Plain.
  • e – External.
  • m – Main.
  • x – Extended.
typnotnull bool A not-null constraint (domains only).
typbasetype oid (references pg_type.oid) A base type for domains.
0 – Not a domain.
typtypmod int4 Used to record typmod that should be applied to the domain’s underlying base type.
-1 – Not applicable.
typndims int4 The number of dimensions in an array defined over a domain.
0 – Not applicable.
typcollation oid (references pg_collation.oid) The collation of the type.
0 – Not supported.
typdefaultbin pg_node_tree The nodeToString() representation of a default expression (domains only).
typdefault text A human-readable default expression.
NULL – No default expression is defined.
typacl aclitem[] Access privileges.