Sophie

Sophie

distrib > Mageia > 7 > x86_64 > by-pkgid > 9b6cc37ce608401d44f6535a0c7cb777 > files > 80

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.10. pg_cast</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-auth-members.html" title="52.9. pg_auth_members" /><link rel="next" href="catalog-pg-class.html" title="52.11. pg_class" /></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.10. <code xmlns="http://www.w3.org/1999/xhtml" class="structname">pg_cast</code></th></tr><tr><td width="10%" align="left"><a accesskey="p" href="catalog-pg-auth-members.html" title="52.9. pg_auth_members">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-class.html" title="52.11. pg_class">Next</a></td></tr></table><hr></hr></div><div class="sect1" id="CATALOG-PG-CAST"><div class="titlepage"><div><div><h2 class="title" style="clear: both">52.10. <code class="structname">pg_cast</code></h2></div></div></div><a id="id-1.10.4.12.2" class="indexterm"></a><p>
   The catalog <code class="structname">pg_cast</code> stores data type conversion
   paths, both built-in and user-defined.
  </p><p>
   It should be noted that <code class="structname">pg_cast</code> does not represent
   every type conversion that the system knows how to perform; only those that
   cannot be deduced from some generic rule.  For example, casting between a
   domain and its base type is not explicitly represented in
   <code class="structname">pg_cast</code>.  Another important exception is that
   <span class="quote">“<span class="quote">automatic I/O conversion casts</span>”</span>, those performed using a data
   type's own I/O functions to convert to or from <code class="type">text</code> or other
   string types, are not explicitly represented in
   <code class="structname">pg_cast</code>.
  </p><div class="table" id="id-1.10.4.12.5"><p class="title"><strong>Table 52.10. <code class="structname">pg_cast</code> Columns</strong></p><div class="table-contents"><table class="table" summary="pg_cast 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">castsource</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>OID of the source data type</td></tr><tr><td><code class="structfield">casttarget</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>OID of the target data type</td></tr><tr><td><code class="structfield">castfunc</code></td><td><code class="type">oid</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>
       The OID of the function to use to perform this cast.  Zero is
       stored if the cast method doesn't require a function.
      </td></tr><tr><td><code class="structfield">castcontext</code></td><td><code class="type">char</code></td><td> </td><td>
       Indicates what contexts the cast can be invoked in.
       <code class="literal">e</code> means only as an explicit cast (using
       <code class="literal">CAST</code> or <code class="literal">::</code> syntax).
       <code class="literal">a</code> means implicitly in assignment
       to a target column, as well as explicitly.
       <code class="literal">i</code> means implicitly in expressions, as well as the
       other cases.
      </td></tr><tr><td><code class="structfield">castmethod</code></td><td><code class="type">char</code></td><td> </td><td>
       Indicates how the cast is performed.
       <code class="literal">f</code> means that the function specified in the <code class="structfield">castfunc</code> field is used.
       <code class="literal">i</code> means that the input/output functions are used.
       <code class="literal">b</code> means that the types are binary-coercible, thus no conversion is required.
      </td></tr></tbody></table></div></div><br class="table-break" /><p>
   The cast functions listed in <code class="structname">pg_cast</code> must
   always take the cast source type as their first argument type, and
   return the cast destination type as their result type.  A cast
   function can have up to three arguments.  The second argument,
   if present, must be type <code class="type">integer</code>; it receives the type
   modifier associated with the destination type, or -1
   if there is none.  The third argument,
   if present, must be type <code class="type">boolean</code>; it receives <code class="literal">true</code>
   if the cast is an explicit cast, <code class="literal">false</code> otherwise.
  </p><p>
   It is legitimate to create a <code class="structname">pg_cast</code> entry
   in which the source and target types are the same, if the associated
   function takes more than one argument.  Such entries represent
   <span class="quote">“<span class="quote">length coercion functions</span>”</span> that coerce values of the type
   to be legal for a particular type modifier value.
  </p><p>
   When a <code class="structname">pg_cast</code> entry has different source and
   target types and a function that takes more than one argument, it
   represents converting from one type to another and applying a length
   coercion in a single step.  When no such entry is available, coercion
   to a type that uses a type modifier involves two steps, one to
   convert between data types and a second to apply the modifier.
  </p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="catalog-pg-auth-members.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-class.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">52.9. <code class="structname">pg_auth_members</code> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 52.11. <code class="structname">pg_class</code></td></tr></table></div></body></html>