mirror of
https://github.com/postgres/postgres.git
synced 2025-05-01 01:04:50 +03:00
Repair erroneous ALTER DROP CONSTRAINT example.
This commit is contained in:
parent
be4e5059a2
commit
26e8a4f356
@ -1,5 +1,5 @@
|
|||||||
<!--
|
<!--
|
||||||
$Header: /cvsroot/pgsql/doc/src/sgml/ref/alter_table.sgml,v 1.30 2001/10/22 18:14:47 petere Exp $
|
$Header: /cvsroot/pgsql/doc/src/sgml/ref/alter_table.sgml,v 1.31 2001/11/10 20:13:37 tgl Exp $
|
||||||
Postgres documentation
|
Postgres documentation
|
||||||
-->
|
-->
|
||||||
|
|
||||||
@ -178,7 +178,7 @@ ALTER TABLE <replaceable class="PARAMETER">table</replaceable>
|
|||||||
adds a new constraint to the table using the same syntax as <xref
|
adds a new constraint to the table using the same syntax as <xref
|
||||||
linkend="SQL-CREATETABLE">.
|
linkend="SQL-CREATETABLE">.
|
||||||
The DROP CONSTRAINT <replaceable class="PARAMETER">constraint</replaceable> clause
|
The DROP CONSTRAINT <replaceable class="PARAMETER">constraint</replaceable> clause
|
||||||
drops all CHECK constraints on the table (and its children) that match <replaceable class="PARAMETER">constraint</replaceable>.
|
drops all constraints on the table (and its children) that match <replaceable class="PARAMETER">constraint</replaceable>.
|
||||||
The OWNER clause changes the owner of the table to the user <replaceable class="PARAMETER">
|
The OWNER clause changes the owner of the table to the user <replaceable class="PARAMETER">
|
||||||
new user</replaceable>.
|
new user</replaceable>.
|
||||||
</para>
|
</para>
|
||||||
@ -207,15 +207,15 @@ ALTER TABLE <replaceable class="PARAMETER">table</replaceable>
|
|||||||
new default value, using <xref linkend="sql-update">.)
|
new default value, using <xref linkend="sql-update">.)
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
Currently only CHECK constraints can be dropped from a table. The RESTRICT
|
In DROP CONSTRAINT, the RESTRICT keyword is required, although
|
||||||
keyword is required, although dependencies are not checked. The CASCADE
|
dependencies are not yet checked. The CASCADE option is unsupported.
|
||||||
option is unsupported. To remove a PRIMARY or UNIQUE constraint, drop the
|
Currently DROP CONSTRAINT drops only CHECK constraints.
|
||||||
relevant index using the <xref linkend="SQL-DROPINDEX"> command.
|
To remove a PRIMARY or UNIQUE constraint, drop the
|
||||||
|
relevant index using the <xref linkend="SQL-DROPINDEX"> command.
|
||||||
To remove FOREIGN KEY constraints you need to recreate
|
To remove FOREIGN KEY constraints you need to recreate
|
||||||
and reload the table, using other parameters to the
|
and reload the table, using other parameters to the
|
||||||
<xref linkend="SQL-CREATETABLE">
|
<xref linkend="SQL-CREATETABLE"> command.
|
||||||
command.
|
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
For example, to drop all constraints on a table <literal>distributors</literal>:
|
For example, to drop all constraints on a table <literal>distributors</literal>:
|
||||||
@ -277,7 +277,7 @@ ALTER TABLE distributors ADD CONSTRAINT zipchk CHECK (char_length(zipcode) = 5);
|
|||||||
<para>
|
<para>
|
||||||
To remove a check constraint from a table and all its children:
|
To remove a check constraint from a table and all its children:
|
||||||
<programlisting>
|
<programlisting>
|
||||||
ALTER TABLE distributors DROP CONSTRAINT zipchk;
|
ALTER TABLE distributors DROP CONSTRAINT zipchk RESTRICT;
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user