mirror of
https://github.com/postgres/postgres.git
synced 2025-07-31 22:04:40 +03:00
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 documents it. Christopher Kings-Lynne
This commit is contained in:
@ -1,5 +1,5 @@
|
|||||||
<!--
|
<!--
|
||||||
$Header: /cvsroot/pgsql/doc/src/sgml/ref/alter_table.sgml,v 1.23 2001/05/07 00:43:15 tgl Exp $
|
$Header: /cvsroot/pgsql/doc/src/sgml/ref/alter_table.sgml,v 1.24 2001/05/09 13:27:15 momjian Exp $
|
||||||
Postgres documentation
|
Postgres documentation
|
||||||
-->
|
-->
|
||||||
|
|
||||||
@ -207,13 +207,10 @@ ALTER TABLE <replaceable class="PARAMETER">table</replaceable>
|
|||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
In the current implementation, only FOREIGN KEY constraints can
|
In the current implementation, only FOREIGN KEY and CHECK constraints can
|
||||||
be added to a table. To create or remove a unique constraint, create
|
be added to a table. To create or remove a unique constraint, create
|
||||||
a unique index (see <xref linkend="SQL-CREATEINDEX"
|
a unique index (see <xref linkend="SQL-CREATEINDEX"
|
||||||
endterm="SQL-CREATEINDEX-title">). To add check constraints
|
endterm="SQL-CREATEINDEX-title">).
|
||||||
you need to recreate and reload the table, using other
|
|
||||||
parameters to the <xref linkend="SQL-CREATETABLE"
|
|
||||||
endterm="SQL-CREATETABLE-title"> command.
|
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
@ -256,6 +253,13 @@ ALTER TABLE distributors RENAME TO suppliers;
|
|||||||
</programlisting>
|
</programlisting>
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
To add a check constraint to a table:
|
||||||
|
<programlisting>
|
||||||
|
ALTER TABLE distributors ADD CONSTRAINT zipchk CHECK (char_length(zipcode) = 5)
|
||||||
|
</programlisting>
|
||||||
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
To add a foreign key constraint to a table:
|
To add a foreign key constraint to a table:
|
||||||
<programlisting>
|
<programlisting>
|
||||||
|
Reference in New Issue
Block a user