Kind people,

This patch adds an example to the CREATE DOMAIN docs.

Cheers,
D
-- 
David Fetter [EMAIL PROTECTED] http://fetter.org/
phone: +1 510 893 6100   mobile: +1 415 235 3778

Remember to vote!
Index: create_domain.sgml
===================================================================
RCS file: /projects/cvsroot/pgsql-server/doc/src/sgml/ref/create_domain.sgml,v
retrieving revision 1.17
diff -u -r1.17 create_domain.sgml
--- create_domain.sgml  29 Nov 2003 19:51:38 -0000      1.17
+++ create_domain.sgml  6 Aug 2004 18:06:30 -0000
@@ -160,11 +160,25 @@
   <title>Examples</title>
 
   <para>
-   This example creates the <type>country_code</type> data type and then uses the
-   type in a table definition:
+   This example creates the <type>us_postal_code</type> data type and
+    then uses the type in a table definition:
+
 <programlisting>
-CREATE DOMAIN country_code char(2) NOT NULL;
-CREATE TABLE countrylist (id integer, country country_code);
+CREATE DOMAIN us_postal_code AS TEXT
+NOT NULL
+CHECK(
+   VALUE ~ $pc$^\d{5}$$pc$
+OR VALUE ~ $pc$^\d{5}-\d{4}$$pc$
+);
+
+CREATE TABLE us_snail_addy (
+  address_id SERIAL NOT NULL PRIMARY KEY
+, street1 TEXT NOT NULL
+, street2 TEXT
+, street3 TEXT
+, city TEXT NOT NULL
+, postal us_postal_code
+);
 </programlisting>
   </para>
  </refsect1>
---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
      joining column's datatypes do not match

Reply via email to