summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2011-09-06 12:14:51 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2011-09-06 12:15:23 -0400
commit1426abb516e8ddd2deca25c43b6a5326fcf8a374 (patch)
tree837d942babcce5257878a750c230bc58064de0fe
parentc2042d04ac3aeacfd83d60222cdfc47bbb58b4b6 (diff)
downloadpostgresql-1426abb516e8ddd2deca25c43b6a5326fcf8a374.tar.gz
Update type-conversion documentation for long-ago changes.
This example wasn't updated when we changed the behavior of bpcharlen() in 8.0, nor when we changed the number of parameters taken by the bpchar() cast function in 7.3. Per report from lsliang.
-rw-r--r--doc/src/sgml/typeconv.sgml22
1 files changed, 12 insertions, 10 deletions
diff --git a/doc/src/sgml/typeconv.sgml b/doc/src/sgml/typeconv.sgml
index f4c521025d..e7f3fcf791 100644
--- a/doc/src/sgml/typeconv.sgml
+++ b/doc/src/sgml/typeconv.sgml
@@ -734,9 +734,11 @@ cast is a cast from that type to itself. If one is found in the
<structname>pg_cast</> catalog, apply it to the expression before storing
into the destination column. The implementation function for such a cast
always takes an extra parameter of type <type>integer</type>, which receives
-the destination column's declared length (actually, its
-<structfield>atttypmod</> value; the interpretation of
-<structfield>atttypmod</> varies for different data types). The cast function
+the destination column's <structfield>atttypmod</> value (typically its
+declared length, although the interpretation of <structfield>atttypmod</>
+varies for different data types), and it may take a third <type>boolean</>
+parameter that says whether the cast is explicit or implicit. The cast
+function
is responsible for applying any length-dependent semantics such as size
checking or truncation.
</para>
@@ -748,17 +750,17 @@ checking or truncation.
<title><type>character</type> Storage Type Conversion</title>
<para>
-For a target column declared as <type>character(20)</type> the following statement
-ensures that the stored value is sized correctly:
+For a target column declared as <type>character(20)</type> the following
+statement shows that the stored value is sized correctly:
<screen>
CREATE TABLE vv (v character(20));
INSERT INTO vv SELECT 'abc' || 'def';
-SELECT v, length(v) FROM vv;
+SELECT v, octet_length(v) FROM vv;
- v | length
-----------------------+--------
- abcdef | 20
+ v | octet_length
+----------------------+--------------
+ abcdef | 20
(1 row)
</screen>
</para>
@@ -772,7 +774,7 @@ char</>, the internal name of the <type>character</type> data type) to match the
column type. (Since the types <type>text</type> and
<type>bpchar</type> are binary-compatible, this conversion does
not insert any real function call.) Finally, the sizing function
-<literal>bpchar(bpchar, integer)</literal> is found in the system catalog
+<literal>bpchar(bpchar, integer, boolean)</> is found in the system catalog
and applied to the operator's result and the stored column length. This
type-specific function performs the required length check and addition of
padding spaces.