summaryrefslogtreecommitdiffstats
path: root/doc/src/sgml/html/catalog-pg-cast.html
diff options
context:
space:
mode:
Diffstat (limited to 'doc/src/sgml/html/catalog-pg-cast.html')
-rw-r--r--doc/src/sgml/html/catalog-pg-cast.html86
1 files changed, 86 insertions, 0 deletions
diff --git a/doc/src/sgml/html/catalog-pg-cast.html b/doc/src/sgml/html/catalog-pg-cast.html
new file mode 100644
index 0000000..84762e5
--- /dev/null
+++ b/doc/src/sgml/html/catalog-pg-cast.html
@@ -0,0 +1,86 @@
+<?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>53.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="53.9. pg_auth_members" /><link rel="next" href="catalog-pg-class.html" title="53.11. pg_class" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">53.10. <code class="structname">pg_cast</code></th></tr><tr><td width="10%" align="left"><a accesskey="p" href="catalog-pg-auth-members.html" title="53.9. pg_auth_members">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="catalogs.html" title="Chapter 53. System Catalogs">Up</a></td><th width="60%" align="center">Chapter 53. System Catalogs</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 15.5 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="catalog-pg-class.html" title="53.11. pg_class">Next</a></td></tr></table><hr /></div><div class="sect1" id="CATALOG-PG-CAST"><div class="titlepage"><div><div><h2 class="title" style="clear: both">53.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 53.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 /></colgroup><thead><tr><th class="catalog_table_entry"><p class="column_definition">
+ Column Type
+ </p>
+ <p>
+ Description
+ </p></th></tr></thead><tbody><tr><td class="catalog_table_entry"><p class="column_definition">
+ <code class="structfield">oid</code> <code class="type">oid</code>
+ </p>
+ <p>
+ Row identifier
+ </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
+ <code class="structfield">castsource</code> <code class="type">oid</code>
+ (references <a class="link" href="catalog-pg-type.html" title="53.64. pg_type"><code class="structname">pg_type</code></a>.<code class="structfield">oid</code>)
+ </p>
+ <p>
+ OID of the source data type
+ </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
+ <code class="structfield">casttarget</code> <code class="type">oid</code>
+ (references <a class="link" href="catalog-pg-type.html" title="53.64. pg_type"><code class="structname">pg_type</code></a>.<code class="structfield">oid</code>)
+ </p>
+ <p>
+ OID of the target data type
+ </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
+ <code class="structfield">castfunc</code> <code class="type">oid</code>
+ (references <a class="link" href="catalog-pg-proc.html" title="53.39. pg_proc"><code class="structname">pg_proc</code></a>.<code class="structfield">oid</code>)
+ </p>
+ <p>
+ The OID of the function to use to perform this cast. Zero is
+ stored if the cast method doesn't require a function.
+ </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
+ <code class="structfield">castcontext</code> <code class="type">char</code>
+ </p>
+ <p>
+ 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.
+ </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
+ <code class="structfield">castmethod</code> <code class="type">char</code>
+ </p>
+ <p>
+ 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.
+ </p></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" title="53.9. pg_auth_members">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="catalogs.html" title="Chapter 53. System Catalogs">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="catalog-pg-class.html" title="53.11. pg_class">Next</a></td></tr><tr><td width="40%" align="left" valign="top">53.9. <code class="structname">pg_auth_members</code> </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 15.5 Documentation">Home</a></td><td width="40%" align="right" valign="top"> 53.11. <code class="structname">pg_class</code></td></tr></table></div></body></html> \ No newline at end of file