Sophie

Sophie

distrib > Mageia > 7 > i586 > by-pkgid > 9b6cc37ce608401d44f6535a0c7cb777 > files > 132

postgresql11-docs-11.5-1.mga7.noarch.rpm

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>52.62. pg_type</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="catalog-pg-ts-template.html" title="52.61. pg_ts_template" /><link rel="next" href="catalog-pg-user-mapping.html" title="52.63. pg_user_mapping" /></head><body><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">52.62. <code xmlns="http://www.w3.org/1999/xhtml" class="structname">pg_type</code></th></tr><tr><td width="10%" align="left"><a accesskey="p" href="catalog-pg-ts-template.html" title="52.61. pg_ts_template">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="catalogs.html" title="Chapter 52. System Catalogs">Up</a></td><th width="60%" align="center">Chapter 52. System Catalogs</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 11.5 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="catalog-pg-user-mapping.html" title="52.63. pg_user_mapping">Next</a></td></tr></table><hr></hr></div><div class="sect1" id="CATALOG-PG-TYPE"><div class="titlepage"><div><div><h2 class="title" style="clear: both">52.62. <code class="structname">pg_type</code></h2></div></div></div><a id="id-1.10.4.64.2" class="indexterm"></a><p>
   The catalog <code class="structname">pg_type</code> stores information about data
   types.  Base types and enum types (scalar types) are created with
   <a class="xref" href="sql-createtype.html" title="CREATE TYPE"><span class="refentrytitle">CREATE TYPE</span></a>, and
   domains with
   <a class="xref" href="sql-createdomain.html" title="CREATE DOMAIN"><span class="refentrytitle">CREATE DOMAIN</span></a>.
   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 <code class="command">CREATE TYPE AS</code>.
  </p><div class="table" id="id-1.10.4.64.4"><p class="title"><strong>Table 52.62. <code class="structname">pg_type</code> Columns</strong></p><div class="table-contents"><table class="table" summary="pg_type Columns" border="1"><colgroup><col /><col /><col /><col /></colgroup><thead><tr><th>Name</th><th>Type</th><th>References</th><th>Description</th></tr></thead><tbody><tr><td><code class="structfield">oid</code></td><td><code class="type">oid</code></td><td> </td><td>Row identifier (hidden attribute; must be explicitly selected)</td></tr><tr><td><code class="structfield">typname</code></td><td><code class="type">name</code></td><td> </td><td>Data type name</td></tr><tr><td><code class="structfield">typnamespace</code></td><td><code class="type">oid</code></td><td><code class="literal"><a class="link" href="catalog-pg-namespace.html" title="52.32. pg_namespace"><code class="structname">pg_namespace</code></a>.oid</code></td><td>
       The OID of the namespace that contains this type
      </td></tr><tr><td><code class="structfield">typowner</code></td><td><code class="type">oid</code></td><td><code class="literal"><a class="link" href="catalog-pg-authid.html" title="52.8. pg_authid"><code class="structname">pg_authid</code></a>.oid</code></td><td>Owner of the type</td></tr><tr><td><code class="structfield">typlen</code></td><td><code class="type">int2</code></td><td> </td><td>
       For a fixed-size type, <code class="structfield">typlen</code> is the number
       of bytes in the internal representation of the type.  But for a
       variable-length type, <code class="structfield">typlen</code> is negative.
       -1 indicates a <span class="quote">“<span class="quote">varlena</span>”</span> type (one that has a length word),
       -2 indicates a null-terminated C string.
      </td></tr><tr><td><code class="structfield">typbyval</code></td><td><code class="type">bool</code></td><td> </td><td>
       <code class="structfield">typbyval</code> determines whether internal
       routines pass a value of this type by value or by reference.
       <code class="structfield">typbyval</code> had better be false if
       <code class="structfield">typlen</code> is not 1, 2, or 4 (or 8 on machines
       where Datum is 8 bytes).
       Variable-length types are always passed by reference. Note that
       <code class="structfield">typbyval</code> can be false even if the
       length would allow pass-by-value.
      </td></tr><tr><td><code class="structfield">typtype</code></td><td><code class="type">char</code></td><td> </td><td>
       <code class="structfield">typtype</code> is
       <code class="literal">b</code> for a base type,
       <code class="literal">c</code> for a composite type (e.g., a table's row type),
       <code class="literal">d</code> for a domain,
       <code class="literal">e</code> for an enum type,
       <code class="literal">p</code> for a pseudo-type, or
       <code class="literal">r</code> for a range type.
       See also <code class="structfield">typrelid</code> and
       <code class="structfield">typbasetype</code>.
      </td></tr><tr><td><code class="structfield">typcategory</code></td><td><code class="type">char</code></td><td> </td><td>
       <code class="structfield">typcategory</code> is an arbitrary classification
       of data types that is used by the parser to determine which implicit
       casts should be <span class="quote">“<span class="quote">preferred</span>”</span>.
       See <a class="xref" href="catalog-pg-type.html#CATALOG-TYPCATEGORY-TABLE" title="Table 52.63. typcategory Codes">Table 52.63</a>.
      </td></tr><tr><td><code class="structfield">typispreferred</code></td><td><code class="type">bool</code></td><td> </td><td>
       True if the type is a preferred cast target within its
       <code class="structfield">typcategory</code>
      </td></tr><tr><td><code class="structfield">typisdefined</code></td><td><code class="type">bool</code></td><td> </td><td>
       True if the type is defined, false if this is a placeholder
       entry for a not-yet-defined type.  When
       <code class="structfield">typisdefined</code> is false, nothing
       except the type name, namespace, and OID can be relied on.
      </td></tr><tr><td><code class="structfield">typdelim</code></td><td><code class="type">char</code></td><td> </td><td>
       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.
      </td></tr><tr><td><code class="structfield">typrelid</code></td><td><code class="type">oid</code></td><td><code class="literal"><a class="link" href="catalog-pg-class.html" title="52.11. pg_class"><code class="structname">pg_class</code></a>.oid</code></td><td>
       If this is a composite type (see
       <code class="structfield">typtype</code>), then this column points to
       the <code class="structname">pg_class</code> entry that defines the
       corresponding table.  (For a free-standing composite type, the
       <code class="structname">pg_class</code> entry doesn't really represent
       a table, but it is needed anyway for the type's
       <code class="structname">pg_attribute</code> entries to link to.)
       Zero for non-composite types.
      </td></tr><tr><td><code class="structfield">typelem</code></td><td><code class="type">oid</code></td><td><code class="literal"><a class="link" href="catalog-pg-type.html" title="52.62. pg_type"><code class="structname">pg_type</code></a>.oid</code></td><td>
       If <code class="structfield">typelem</code> is not 0 then it
       identifies another row in <code class="structname">pg_type</code>.
       The current type can then be subscripted like an array yielding
       values of type <code class="structfield">typelem</code>.  A
       <span class="quote">“<span class="quote">true</span>”</span> array type is variable length
       (<code class="structfield">typlen</code> = -1),
       but some fixed-length (<code class="structfield">typlen</code> &gt; 0) types
       also have nonzero <code class="structfield">typelem</code>, for example
       <code class="type">name</code> and <code class="type">point</code>.
       If a fixed-length type has a <code class="structfield">typelem</code> then
       its internal representation must be some number of values of the
       <code class="structfield">typelem</code> data type with no other data.
       Variable-length array types have a header defined by the array
       subroutines.
      </td></tr><tr><td><code class="structfield">typarray</code></td><td><code class="type">oid</code></td><td><code class="literal"><a class="link" href="catalog-pg-type.html" title="52.62. pg_type"><code class="structname">pg_type</code></a>.oid</code></td><td>
       If <code class="structfield">typarray</code> is not 0 then it
       identifies another row in <code class="structname">pg_type</code>, which
       is the <span class="quote">“<span class="quote">true</span>”</span> array type having this type as element
      </td></tr><tr><td><code class="structfield">typinput</code></td><td><code class="type">regproc</code></td><td><code class="literal"><a class="link" href="catalog-pg-proc.html" title="52.39. pg_proc"><code class="structname">pg_proc</code></a>.oid</code></td><td>Input conversion function (text format)</td></tr><tr><td><code class="structfield">typoutput</code></td><td><code class="type">regproc</code></td><td><code class="literal"><a class="link" href="catalog-pg-proc.html" title="52.39. pg_proc"><code class="structname">pg_proc</code></a>.oid</code></td><td>Output conversion function (text format)</td></tr><tr><td><code class="structfield">typreceive</code></td><td><code class="type">regproc</code></td><td><code class="literal"><a class="link" href="catalog-pg-proc.html" title="52.39. pg_proc"><code class="structname">pg_proc</code></a>.oid</code></td><td>Input conversion function (binary format), or 0 if none</td></tr><tr><td><code class="structfield">typsend</code></td><td><code class="type">regproc</code></td><td><code class="literal"><a class="link" href="catalog-pg-proc.html" title="52.39. pg_proc"><code class="structname">pg_proc</code></a>.oid</code></td><td>Output conversion function (binary format), or 0 if none</td></tr><tr><td><code class="structfield">typmodin</code></td><td><code class="type">regproc</code></td><td><code class="literal"><a class="link" href="catalog-pg-proc.html" title="52.39. pg_proc"><code class="structname">pg_proc</code></a>.oid</code></td><td>Type modifier input function, or 0 if type does not support modifiers</td></tr><tr><td><code class="structfield">typmodout</code></td><td><code class="type">regproc</code></td><td><code class="literal"><a class="link" href="catalog-pg-proc.html" title="52.39. pg_proc"><code class="structname">pg_proc</code></a>.oid</code></td><td>Type modifier output function, or 0 to use the standard format</td></tr><tr><td><code class="structfield">typanalyze</code></td><td><code class="type">regproc</code></td><td><code class="literal"><a class="link" href="catalog-pg-proc.html" title="52.39. pg_proc"><code class="structname">pg_proc</code></a>.oid</code></td><td>Custom <code class="command">ANALYZE</code> function, or 0 to use the standard function</td></tr><tr><td><code class="structfield">typalign</code></td><td><code class="type">char</code></td><td> </td><td><p>

       <code class="structfield">typalign</code> is 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
       <span class="productname">PostgreSQL</span>.
       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.
      </p>

      <p>
       Possible values are:
       </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><code class="literal">c</code> = <code class="type">char</code> alignment, i.e., no alignment needed.</p></li><li class="listitem"><p><code class="literal">s</code> = <code class="type">short</code> alignment (2 bytes on most machines).</p></li><li class="listitem"><p><code class="literal">i</code> = <code class="type">int</code> alignment (4 bytes on most machines).</p></li><li class="listitem"><p><code class="literal">d</code> = <code class="type">double</code> alignment (8 bytes on many machines, but by no means all).</p></li></ul></div><p>
      </p><div class="note"><h3 class="title">Note</h3><p>
        For types used in system tables, it is critical that the size
        and alignment defined in <code class="structname">pg_type</code>
        agree with the way that the compiler will lay out the column in
        a structure representing a table row.
       </p></div></td></tr><tr><td><code class="structfield">typstorage</code></td><td><code class="type">char</code></td><td> </td><td><p>
       <code class="structfield">typstorage</code> tells for varlena
       types (those with <code class="structfield">typlen</code> = -1) if
       the type is prepared for toasting and what the default strategy
       for attributes of this type should be.
       Possible values are
       </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><code class="literal">p</code>: Value must always be stored plain.</p></li><li class="listitem"><p>
          <code class="literal">e</code>: Value can be stored in a <span class="quote">“<span class="quote">secondary</span>”</span>
          relation (if relation has one, see
          <code class="literal">pg_class.reltoastrelid</code>).
         </p></li><li class="listitem"><p><code class="literal">m</code>: Value can be stored compressed inline.</p></li><li class="listitem"><p><code class="literal">x</code>: Value can be stored compressed inline or stored in <span class="quote">“<span class="quote">secondary</span>”</span> storage.</p></li></ul></div><p>
       Note that <code class="literal">m</code> columns can also be moved out to secondary
       storage, but only as a last resort (<code class="literal">e</code> and <code class="literal">x</code> columns are
       moved first).
      </p></td></tr><tr><td><code class="structfield">typnotnull</code></td><td><code class="type">bool</code></td><td> </td><td><p>
       <code class="structfield">typnotnull</code> represents a not-null
       constraint on a type.  Used for domains only.
      </p></td></tr><tr><td><code class="structfield">typbasetype</code></td><td><code class="type">oid</code></td><td><code class="literal"><a class="link" href="catalog-pg-type.html" title="52.62. pg_type"><code class="structname">pg_type</code></a>.oid</code></td><td><p>
       If this is a domain (see <code class="structfield">typtype</code>), then
       <code class="structfield">typbasetype</code> identifies the type that this
       one is based on.  Zero if this type is not a domain.
      </p></td></tr><tr><td><code class="structfield">typtypmod</code></td><td><code class="type">int4</code></td><td> </td><td><p>
       Domains use <code class="structfield">typtypmod</code> to record the <code class="literal">typmod</code>
       to be applied to their base type (-1 if base type does not use a
       <code class="literal">typmod</code>).  -1 if this type is not a domain.
      </p></td></tr><tr><td><code class="structfield">typndims</code></td><td><code class="type">int4</code></td><td> </td><td><p>
       <code class="structfield">typndims</code> is the number of array dimensions
       for a domain over an array (that is, <code class="structfield">typbasetype</code> is
       an array type).
       Zero for types other than domains over array types.
       </p></td></tr><tr><td><code class="structfield">typcollation</code></td><td><code class="type">oid</code></td><td><code class="literal"><a class="link" href="catalog-pg-collation.html" title="52.12. pg_collation"><code class="structname">pg_collation</code></a>.oid</code></td><td><p>
       <code class="structfield">typcollation</code> specifies the collation
       of the type.  If the type does not support collations, this will
       be zero.  A base type that supports collations will have
       <code class="symbol">DEFAULT_COLLATION_OID</code> here.  A domain over a
       collatable type can have some other collation OID, if one was
       specified for the domain.
      </p></td></tr><tr><td><code class="structfield">typdefaultbin</code></td><td><code class="type">pg_node_tree</code></td><td> </td><td><p>
       If <code class="structfield">typdefaultbin</code> is not null, it is the
       <code class="function">nodeToString()</code>
       representation of a default expression for the type.  This is
       only used for domains.
      </p></td></tr><tr><td><code class="structfield">typdefault</code></td><td><code class="type">text</code></td><td> </td><td><p>
       <code class="structfield">typdefault</code> is null if the type has no associated
       default value. If <code class="structfield">typdefaultbin</code> is not null,
       <code class="structfield">typdefault</code> must contain a human-readable version of the
       default expression represented by <code class="structfield">typdefaultbin</code>.  If
       <code class="structfield">typdefaultbin</code> is null and <code class="structfield">typdefault</code> is
       not, then <code class="structfield">typdefault</code> is the external representation of
       the type's default value, which can be fed to the type's input
       converter to produce a constant.
      </p></td></tr><tr><td><code class="structfield">typacl</code></td><td><code class="type">aclitem[]</code></td><td> </td><td>
       Access privileges; see
       <a class="xref" href="sql-grant.html" title="GRANT"><span class="refentrytitle">GRANT</span></a> and
       <a class="xref" href="sql-revoke.html" title="REVOKE"><span class="refentrytitle">REVOKE</span></a>
       for details
      </td></tr></tbody></table></div></div><br class="table-break" /><p>
   <a class="xref" href="catalog-pg-type.html#CATALOG-TYPCATEGORY-TABLE" title="Table 52.63. typcategory Codes">Table 52.63</a> lists the system-defined values
   of <code class="structfield">typcategory</code>.  Any future additions to this list will
   also be upper-case ASCII letters.  All other ASCII characters are reserved
   for user-defined categories.
  </p><div class="table" id="CATALOG-TYPCATEGORY-TABLE"><p class="title"><strong>Table 52.63. <code class="structfield">typcategory</code> Codes</strong></p><div class="table-contents"><table class="table" summary="typcategory Codes" border="1"><colgroup><col /><col /></colgroup><thead><tr><th>Code</th><th>Category</th></tr></thead><tbody><tr><td><code class="literal">A</code></td><td>Array types</td></tr><tr><td><code class="literal">B</code></td><td>Boolean types</td></tr><tr><td><code class="literal">C</code></td><td>Composite types</td></tr><tr><td><code class="literal">D</code></td><td>Date/time types</td></tr><tr><td><code class="literal">E</code></td><td>Enum types</td></tr><tr><td><code class="literal">G</code></td><td>Geometric types</td></tr><tr><td><code class="literal">I</code></td><td>Network address types</td></tr><tr><td><code class="literal">N</code></td><td>Numeric types</td></tr><tr><td><code class="literal">P</code></td><td>Pseudo-types</td></tr><tr><td><code class="literal">R</code></td><td>Range types</td></tr><tr><td><code class="literal">S</code></td><td>String types</td></tr><tr><td><code class="literal">T</code></td><td>Timespan types</td></tr><tr><td><code class="literal">U</code></td><td>User-defined types</td></tr><tr><td><code class="literal">V</code></td><td>Bit-string types</td></tr><tr><td><code class="literal">X</code></td><td><code class="type">unknown</code> type</td></tr></tbody></table></div></div><br class="table-break" /></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="catalog-pg-ts-template.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="catalogs.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="catalog-pg-user-mapping.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">52.61. <code class="structname">pg_ts_template</code> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 52.63. <code class="structname">pg_user_mapping</code></td></tr></table></div></body></html>