@@ -734,9 +734,11 @@ cast is a cast from that type to itself. If one is found in the
734734<structname>pg_cast</> catalog, apply it to the expression before storing
735735into the destination column. The implementation function for such a cast
736736always takes an extra parameter of type <type>integer</type>, which receives
737- the destination column's declared length (actually, its
738- <structfield>atttypmod</> value; the interpretation of
739- <structfield>atttypmod</> varies for different data types). The cast function
737+ the destination column's <structfield>atttypmod</> value (typically its
738+ declared length, although the interpretation of <structfield>atttypmod</>
739+ varies for different data types), and it may take a third <type>boolean</>
740+ parameter that says whether the cast is explicit or implicit. The cast
741+ function
740742is responsible for applying any length-dependent semantics such as size
741743checking or truncation.
742744</para>
@@ -748,17 +750,17 @@ checking or truncation.
748750<title><type>character</type> Storage Type Conversion</title>
749751
750752<para>
751- For a target column declared as <type>character(20)</type> the following statement
752- ensures that the stored value is sized correctly:
753+ For a target column declared as <type>character(20)</type> the following
754+ statement shows that the stored value is sized correctly:
753755
754756<screen>
755757CREATE TABLE vv (v character(20));
756758INSERT INTO vv SELECT 'abc' || 'def';
757- SELECT v, length (v) FROM vv;
759+ SELECT v, octet_length (v) FROM vv;
758760
759- v | length
760- ----------------------+--------
761- abcdef | 20
761+ v | octet_length
762+ ----------------------+--------------
763+ abcdef | 20
762764(1 row)
763765</screen>
764766</para>
@@ -772,7 +774,7 @@ char</>, the internal name of the <type>character</type> data type) to match the
772774column type. (Since the types <type>text</type> and
773775<type>bpchar</type> are binary-compatible, this conversion does
774776not insert any real function call.) Finally, the sizing function
775- <literal>bpchar(bpchar, integer)</literal > is found in the system catalog
777+ <literal>bpchar(bpchar, integer, boolean )</> is found in the system catalog
776778and applied to the operator's result and the stored column length. This
777779type-specific function performs the required length check and addition of
778780padding spaces.
0 commit comments