On Fri, 2008-11-07 at 09:11 -0800, David E. Wheeler wrote:
> On Nov 6, 2008, at 11:51 PM, Jeff Davis wrote:
>
> > It needs documentation, and I included a quick patch for that (if
> > that's
> > helpful).
>
> You mis-spelled "cast" as "case".
>
Thanks. Updated diff attached.
Regards,
Jeff Davis
diff --git a/doc/src/sgml/ref/create_domain.sgml b/doc/src/sgml/ref/create_domain.sgml
index b26d575..3805c86 100644
--- a/doc/src/sgml/ref/create_domain.sgml
+++ b/doc/src/sgml/ref/create_domain.sgml
@@ -57,6 +57,12 @@ where <replaceable class="PARAMETER">constraint</replaceable> is:
Define a domain rather than setting up each table's constraint
individually.
</para>
+
+ <para>
+ Domains are similar to distinct types, described in <xref
+ linkend="sql-createtype">, except that you can specify defaults or
+ constraints, and a domain can be implicitly cast to its base type.
+ </para>
</refsect1>
<refsect1>
diff --git a/doc/src/sgml/ref/create_type.sgml b/doc/src/sgml/ref/create_type.sgml
index 70ddae6..db9408a 100644
--- a/doc/src/sgml/ref/create_type.sgml
+++ b/doc/src/sgml/ref/create_type.sgml
@@ -26,6 +26,8 @@ CREATE TYPE <replaceable class="parameter">name</replaceable> AS
CREATE TYPE <replaceable class="parameter">name</replaceable> AS ENUM
( '<replaceable class="parameter">label</replaceable>' [, ... ] )
+CREATE TYPE <replaceable class="parameter">name</replaceable> AS <replaceable class="parameter">data_type</replaceable>
+
CREATE TYPE <replaceable class="parameter">name</replaceable> (
INPUT = <replaceable class="parameter">input_function</replaceable>,
OUTPUT = <replaceable class="parameter">output_function</replaceable>
@@ -95,10 +97,25 @@ CREATE TYPE <replaceable class="parameter">name</replaceable>
</refsect2>
<refsect2>
+ <title>Distinct Types</title>
+
+ <para>
+ The third form of <command>CREATE TYPE</command> creates a
+ distinct type. Distinct types are similar to domains, as described
+ in <xref linkend="sql-createdomain">, except that they do not have
+ defaults or constraints, and they cannot be implicitly cast to
+ their base type. Distinct types are useful to avoid making
+ mistakes by comparing two unrelated values that happen to be the
+ same type, such as two integers representing supplier number and
+ part number.
+ </para>
+ </refsect2>
+
+ <refsect2>
<title>Base Types</title>
<para>
- The third form of <command>CREATE TYPE</command> creates a new base type
+ The fourth form of <command>CREATE TYPE</command> creates a new base type
(scalar type). To create a new base type, you must be a superuser.
(This restriction is made because an erroneous type definition could
confuse or even crash the server.)
--
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers