Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0236b5e

Browse files
committed
This patch adds an example to the CREATE DOMAIN docs.
David Fetter
1 parentff8d68d commit0236b5e

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

‎doc/src/sgml/ref/create_domain.sgml

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/ref/create_domain.sgml,v 1.17 2003/11/29 19:51:38 pgsql Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/create_domain.sgml,v 1.18 2004/08/08 01:49:30 momjian Exp $
33
PostgreSQL documentation
44
-->
55

@@ -160,11 +160,25 @@ where <replaceable class="PARAMETER">constraint</replaceable> is:
160160
<title>Examples</title>
161161

162162
<para>
163-
This example creates the <type>country_code</type> data type and then uses the
164-
type in a table definition:
163+
This example creates the <type>us_postal_code</type> data type and
164+
then uses the type in a table definition:
165+
165166
<programlisting>
166-
CREATE DOMAIN country_code char(2) NOT NULL;
167-
CREATE TABLE countrylist (id integer, country country_code);
167+
CREATE DOMAIN us_postal_code AS TEXT
168+
NOT NULL
169+
CHECK(
170+
VALUE ~ $pc$^\d{5}$$pc$
171+
OR VALUE ~ $pc$^\d{5}-\d{4}$$pc$
172+
);
173+
174+
CREATE TABLE us_snail_addy (
175+
address_id SERIAL NOT NULL PRIMARY KEY
176+
, street1 TEXT NOT NULL
177+
, street2 TEXT
178+
, street3 TEXT
179+
, city TEXT NOT NULL
180+
, postal us_postal_code
181+
);
168182
</programlisting>
169183
</para>
170184
</refsect1>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp