11<!--
2- $PostgreSQL: pgsql/doc/src/sgml/ref/create_domain.sgml,v 1.18 2004/08/0801:49:30 momjian Exp $
2+ $PostgreSQL: pgsql/doc/src/sgml/ref/create_domain.sgml,v 1.19 2004/08/0802:05:32 tgl Exp $
33PostgreSQL documentation
44-->
55
@@ -161,14 +161,14 @@ where <replaceable class="PARAMETER">constraint</replaceable> is:
161161
162162 <para>
163163 This example creates the <type>us_postal_code</type> data type and
164- then uses the type in a table definition:
164+ then uses the type in a table definition. A regular expression test
165+ is used to verify that the value looks like a valid US postal code.
165166
166167<programlisting>
167168CREATE DOMAIN us_postal_code AS TEXT
168- NOT NULL
169169CHECK(
170- VALUE ~$pc$ ^\d{5}$$pc$
171- OR VALUE ~$pc$ ^\d{5}-\d{4}$$pc$
170+ VALUE ~' ^\d{5}$'
171+ OR VALUE ~' ^\d{5}-\d{4}$'
172172);
173173
174174CREATE TABLE us_snail_addy (
@@ -177,7 +177,7 @@ CREATE TABLE us_snail_addy (
177177, street2 TEXT
178178, street3 TEXT
179179, city TEXT NOT NULL
180- , postal us_postal_code
180+ , postal us_postal_code NOT NULL
181181);
182182</programlisting>
183183 </para>