pg_type   The catalog pg_type stores information about data
   types.  Base types and enum 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.
  
Table 51.62. pg_type Columns
| Name | Type | References | Description | 
|---|---|---|---|
| oid | oid | Row identifier (hidden attribute; must be explicitly selected) | |
| typname | name | Data type name | |
| typnamespace | oid |  | The OID of the namespace that contains this type | 
| typowner | oid |  | Owner of the type | 
| typlen | int2 | For a fixed-size type, typlenis the number
       of bytes in the internal representation of the type.  But for a
       variable-length type,typlenis negative.
       -1 indicates a “varlena” type (one that has a length word),
       -2 indicates a null-terminated C string. | |
| typbyval | bool | typbyvaldetermines whether internal
       routines pass a value of this type by value or by reference.typbyvalhad better be false iftyplenis not 1, 2, or 4 (or 8 on machines
       where Datum is 8 bytes).
       Variable-length types are always passed by reference. Note thattypbyvalcan be false even if the
       length would allow pass-by-value. | |
| typtype | char | typtypeisbfor a base type,cfor a composite type (e.g., a table's row type),dfor a domain,efor an enum type,pfor a pseudo-type, orrfor a range type.
       See alsotyprelidandtypbasetype. | |
| typcategory | char | typcategoryis an arbitrary classification
       of data types that is used by the parser to determine which implicit
       casts should be “preferred”.
       See Table 51.63. | |
| typispreferred | bool | True if the type is a preferred cast target within its typcategory | |
| typisdefined | bool | True if the type is defined, false if this is a placeholder
       entry for a not-yet-defined type.  When typisdefinedis false, nothing
       except the type name, namespace, and OID can be relied on. | |
| 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 |  | If this is a composite type (see typtype), then this column points to
       thepg_classentry that defines the
       corresponding table.  (For a free-standing composite type, thepg_classentry doesn't really represent
       a table, but it is needed anyway for the type'spg_attributeentries to link to.)
       Zero for non-composite types. | 
| typelem | oid |  | If typelemis not 0 then it
       identifies another row inpg_type.
       The current type can then be subscripted like an array yielding
       values of typetypelem.  A
       “true” array type is variable length
       (typlen= -1),
       but some fixed-length (typlen> 0) types
       also have nonzerotypelem, for examplenameandpoint.
       If a fixed-length type has atypelemthen
       its internal representation must be some number of values of thetypelemdata type with no other data.
       Variable-length array types have a header defined by the array
       subroutines. | 
| typarray | oid |  | If typarrayis not 0 then it
       identifies another row inpg_type, which
       is the “true” array type having this type as element | 
| typinput | regproc |  | Input conversion function (text format) | 
| typoutput | regproc |  | Output conversion function (text format) | 
| typreceive | regproc |  | Input conversion function (binary format), or 0 if none | 
| typsend | regproc |  | Output conversion function (binary format), or 0 if none | 
| typmodin | regproc |  | Type modifier input function, or 0 if type does not support modifiers | 
| typmodout | regproc |  | Type modifier output function, or 0 to use the standard format | 
| typanalyze | regproc |  | Custom ANALYZEfunction, or 0 to use the standard function | 
| typalign | char | 
        Possible values are: 
 
 Note        For types used in system tables, it is critical that the size
        and alignment defined in  | |
| typstorage | char |         
 
       Note that  | |
| typnotnull | bool |         | |
| typbasetype | oid |  |        If this is a domain (see  | 
| typtypmod | int4 |        Domains use  | |
| typndims | int4 |         | |
| typcollation | oid |  |         | 
| typdefaultbin | pg_node_tree |        If  | |
| typdefault | text |         | |
| typacl | aclitem[] | Access privileges; see GRANT and REVOKE for details | 
   Table 51.63 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.
  
Table 51.63. typcategory Codes
| 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 | unknowntype |