pg_type
The pg_type system catalog table stores information about data types.
Base types (scalar types) are created with CREATE TYPE, and domains with CREATE DOMAIN.
A composite type is automatically created for each table in the database to represent the row structure of the table.
It is also possible to create composite types with CREATE TYPE AS.
| Column | Type | References | Description |
|---|---|---|---|
oid |
oid |
— |
Row identifier (hidden attribute; must be explicitly selected) |
typname |
name |
— |
Data type name |
typnamespace |
oid |
pg_namespace.oid |
The OID of the namespace that contains this type |
typowner |
oid |
pg_authid.oid |
Owner of the type |
typlen |
int2 |
— |
For a fixed-size type, |
typbyval |
boolean |
— |
Determines whether internal routines pass a value of this type by value or by reference.
|
typtype |
char |
— |
See also |
typcategory |
char |
— |
Arbitrary classification of data types that is used by the parser to determine which implicit casts should be preferred. See category codes |
typispreferred |
boolean |
— |
|
typisdefined |
boolean |
— |
|
typdelim |
char |
— |
Character that separates two values of this type when parsing array input. Note that the delimiter is associated with the array element data type, not the array data type |
typrelid |
oid |
pg_class.oid |
If this is a composite type (see |
typelem |
oid |
pg_type.oid |
If not |
typarray |
oid |
pg_type.oid |
If not |
typinput |
regproc |
pg_proc.oid |
Input conversion function (text format) |
typoutput |
regproc |
pg_proc.oid |
Output conversion function (text format) |
typreceive |
regproc |
pg_proc.oid |
Input conversion function (binary format), or |
typsend |
regproc |
pg_proc.oid |
Output conversion function (binary format), or |
typmodin |
regproc |
pg_proc.oid |
Type modifier input function, or |
typmodout |
regproc |
pg_proc.oid |
Type modifier output function, or |
typanalyze |
regproc |
pg_proc.oid |
Custom |
typalign |
char |
— |
The alignment required when storing a value of this type. It applies to storage on disk as well as most representations of the value inside Greengage DB. When multiple values are stored consecutively, such as in the representation of a complete row on disk, padding is inserted before a datum of this type so that it begins on the specified boundary. The alignment reference is the beginning of the first datum in the sequence. Possible values are:
|
typstorage |
char |
— |
For
Note that |
typnotnull |
boolean |
— |
Represents a not-null constraint on a type. Used for domains only |
typbasetype |
oid |
pg_type.oid |
Identifies the type that a domain is based on.
|
typtypmod |
integer |
— |
Domains use |
typndims |
integer |
— |
The number of array dimensions for a domain over an array (if |
typcollation |
oid |
pg_collation.oid |
Specifies the collation of the type.
|
typdefaultbin |
pg_node_tree |
— |
If not |
typdefault |
text |
— |
|
typacl |
aclitem[] |
— |
Access privileges (see Roles and privileges) |
The following table lists the system-defined values of typcategory.
Any future additions to this list will also be upper-case ASCII letters.
All other ASCII characters are reserved for user-defined categories.
| Code | Category |
|---|---|
A |
Array types |
B |
boolean types |
C |
Composite types |
D |
Date/time types |
E |
Enum types |
G |
Geometric types |
I |
Network address types |
N |
Numeric types |
P |
Pseudo-types |
R |
Range types |
S |
String types |
T |
Timespan types |
U |
User-defined types |
V |
Bit-string types |
X |
|