@@ -734,9 +734,11 @@ cast is a cast from that type to itself. If one is found in the
734
734
<structname>pg_cast</> catalog, apply it to the expression before storing
735
735
into the destination column. The implementation function for such a cast
736
736
always 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
740
742
is responsible for applying any length-dependent semantics such as size
741
743
checking or truncation.
742
744
</para>
@@ -748,17 +750,17 @@ checking or truncation.
748
750
<title><type>character</type> Storage Type Conversion</title>
749
751
750
752
<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:
753
755
754
756
<screen>
755
757
CREATE TABLE vv (v character(20));
756
758
INSERT INTO vv SELECT 'abc' || 'def';
757
- SELECT v, length (v) FROM vv;
759
+ SELECT v, octet_length (v) FROM vv;
758
760
759
- v | length
760
- ----------------------+--------
761
- abcdef | 20
761
+ v | octet_length
762
+ ----------------------+--------------
763
+ abcdef | 20
762
764
(1 row)
763
765
</screen>
764
766
</para>
@@ -772,7 +774,7 @@ char</>, the internal name of the <type>character</type> data type) to match the
772
774
column type. (Since the types <type>text</type> and
773
775
<type>bpchar</type> are binary-compatible, this conversion does
774
776
not 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
776
778
and applied to the operator's result and the stored column length. This
777
779
type-specific function performs the required length check and addition of
778
780
padding spaces.
0 commit comments