1
- <!-- $Header: /cvsroot/pgsql/doc/src/sgml/ref/create_cast.sgml,v 1.2 2002/08/11 17:44:12 petere Exp $ -->
1
+ <!-- $Header: /cvsroot/pgsql/doc/src/sgml/ref/create_cast.sgml,v 1.3 2002/09/01 02:37:02 tgl Exp $ -->
2
2
3
3
<refentry id="SQL-CREATECAST">
4
4
<refmeta>
@@ -28,8 +28,8 @@ CREATE CAST (<replaceable>sourcetype</replaceable> AS <replaceable>targettype</r
28
28
29
29
<para>
30
30
<command>CREATE CAST</command> defines a new cast. A cast
31
- specifies which function can be invoked when a conversion between
32
- two data types is requested . For example,
31
+ specifies how to perform a conversion between
32
+ two data types. For example,
33
33
<programlisting>
34
34
SELECT CAST(42 AS text);
35
35
</programlisting>
@@ -49,7 +49,7 @@ SELECT CAST(42 AS text);
49
49
</para>
50
50
51
51
<para>
52
- A cast can marked <literal>AS ASSIGNMENT</>, which means that it
52
+ A cast can be marked <literal>AS ASSIGNMENT</>, which means that it
53
53
can be invoked implicitly in any context where the conversion it
54
54
defines is required. Cast functions not so marked can be invoked
55
55
only by explicit <literal>CAST</>,
@@ -72,7 +72,7 @@ INSERT INTO foo(f1) VALUES(42);
72
72
<productname>PostgreSQL</productname> to choose surprising
73
73
interpretations of commands, or to be unable to resolve commands at
74
74
all because there are multiple possible interpretations. A good
75
- rule of thumb is to make cast implicitly invokable only for
75
+ rule of thumb is to make a cast implicitly invokable only for
76
76
information-preserving transformations between types in the same
77
77
general type category. For example, <type>int2</type> to
78
78
<type>int4</type> casts can reasonably be implicit, but be wary of
@@ -161,9 +161,10 @@ INSERT INTO foo(f1) VALUES(42);
161
161
<para>
162
162
Prior to PostgreSQL 7.3, every function that had the same name as a
163
163
data type, returned that data type, and took one argument of a
164
- different type was automatically a cast function. This system has
164
+ different type was automatically a cast function. This convention has
165
165
been abandoned in face of the introduction of schemas and to be
166
- able to store binary compatible casts. The built-in cast functions
166
+ able to represent binary compatible casts in the catalogs. The built-in
167
+ cast functions
167
168
still follow this naming scheme, but they have to be declared as
168
169
casts explicitly now.
169
170
</para>
@@ -175,7 +176,7 @@ INSERT INTO foo(f1) VALUES(42);
175
176
176
177
<para>
177
178
To create a cast from type <type>text</type> to type
178
- <type>int </type> using the function <literal>int4(text)</literal>:
179
+ <type>int4 </type> using the function <literal>int4(text)</literal>:
179
180
<programlisting>
180
181
CREATE CAST (text AS int4) WITH FUNCTION int4(text);
181
182
</programlisting>
0 commit comments