File tree 1 file changed +6
-6
lines changed
1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change 1
1
<!--
2
- $PostgreSQL: pgsql/doc/src/sgml/ref/create_domain.sgml,v 1.18 2004/08/08 01:49:30 momjian Exp $
2
+ $PostgreSQL: pgsql/doc/src/sgml/ref/create_domain.sgml,v 1.19 2004/08/08 02:05:32 tgl Exp $
3
3
PostgreSQL documentation
4
4
-->
5
5
@@ -161,14 +161,14 @@ where <replaceable class="PARAMETER">constraint</replaceable> is:
161
161
162
162
<para>
163
163
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.
165
166
166
167
<programlisting>
167
168
CREATE DOMAIN us_postal_code AS TEXT
168
- NOT NULL
169
169
CHECK(
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}$'
172
172
);
173
173
174
174
CREATE TABLE us_snail_addy (
@@ -177,7 +177,7 @@ CREATE TABLE us_snail_addy (
177
177
, street2 TEXT
178
178
, street3 TEXT
179
179
, city TEXT NOT NULL
180
- , postal us_postal_code
180
+ , postal us_postal_code NOT NULL
181
181
);
182
182
</programlisting>
183
183
</para>
You can’t perform that action at this time.
0 commit comments