aboutsummaryrefslogtreecommitdiff
path: root/doc/src/sgml/ref/alter_table.sgml
diff options
context:
space:
mode:
Diffstat (limited to 'doc/src/sgml/ref/alter_table.sgml')
-rw-r--r--doc/src/sgml/ref/alter_table.sgml12
1 files changed, 7 insertions, 5 deletions
diff --git a/doc/src/sgml/ref/alter_table.sgml b/doc/src/sgml/ref/alter_table.sgml
index 01d3105bf6c..4c2a4cd22ec 100644
--- a/doc/src/sgml/ref/alter_table.sgml
+++ b/doc/src/sgml/ref/alter_table.sgml
@@ -240,12 +240,14 @@ ALTER TABLE <replaceable class="PARAMETER">name</replaceable>
This form adds a new constraint to a table using the same syntax as
<xref linkend="SQL-CREATETABLE">, plus the option <literal>NOT
VALID</literal>, which is currently only allowed for foreign key
- constraints.
+ and CHECK constraints.
If the constraint is marked <literal>NOT VALID</literal>, the
potentially-lengthy initial check to verify that all rows in the table
satisfy the constraint is skipped. The constraint will still be
enforced against subsequent inserts or updates (that is, they'll fail
- unless there is a matching row in the referenced table). But the
+ unless there is a matching row in the referenced table, in the case
+ of foreign keys; and they'll fail unless the new row matches the
+ specified check constraints). But the
database will not assume that the constraint holds for all rows in
the table, until it is validated by using the <literal>VALIDATE
CONSTRAINT</literal> option.
@@ -308,10 +310,10 @@ ALTER TABLE <replaceable class="PARAMETER">name</replaceable>
<term><literal>VALIDATE CONSTRAINT</literal></term>
<listitem>
<para>
- This form validates a foreign key constraint that was previously created
+ This form validates a foreign key or check constraint that was previously created
as <literal>NOT VALID</literal>, by scanning the table to ensure there
- are no unmatched rows. Nothing happens if the constraint is
- already marked valid.
+ are no rows for which the constraint is not satisfied.
+ Nothing happens if the constraint is already marked valid.
The value of separating validation from initial creation of the
constraint is that validation requires a lesser lock on the table
than constraint creation does.