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

Commit1ef9338

Browse files
committed
If it's true that the ALTER TABLE x ADD CONSTRAINT x CHECK (x) syntax is
supported in 7.1.1, here is a patch to that alter_table.sgml that documentsit.Christopher Kings-Lynne
1 parent6cda3ad commit1ef9338

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

‎doc/src/sgml/ref/alter_table.sgml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/alter_table.sgml,v 1.23 2001/05/07 00:43:15tgl Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/alter_table.sgml,v 1.24 2001/05/09 13:27:15momjian Exp $
33
Postgres documentation
44
-->
55

@@ -207,13 +207,10 @@ ALTER TABLE <replaceable class="PARAMETER">table</replaceable>
207207
</para>
208208

209209
<para>
210-
In the current implementation, only FOREIGN KEY constraints can
210+
In the current implementation, only FOREIGN KEYand CHECKconstraints can
211211
be added to a table. To create or remove a unique constraint, create
212212
a unique index (see <xref linkend="SQL-CREATEINDEX"
213-
endterm="SQL-CREATEINDEX-title">). To add check constraints
214-
you need to recreate and reload the table, using other
215-
parameters to the <xref linkend="SQL-CREATETABLE"
216-
endterm="SQL-CREATETABLE-title"> command.
213+
endterm="SQL-CREATEINDEX-title">).
217214
</para>
218215

219216
<para>
@@ -256,6 +253,13 @@ ALTER TABLE distributors RENAME TO suppliers;
256253
</programlisting>
257254
</para>
258255

256+
<para>
257+
To add a check constraint to a table:
258+
<programlisting>
259+
ALTER TABLE distributors ADD CONSTRAINT zipchk CHECK (char_length(zipcode) = 5)
260+
</programlisting>
261+
</para>
262+
259263
<para>
260264
To add a foreign key constraint to a table:
261265
<programlisting>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp