Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 62a47ae

Browse files
committed
doc: Some copy-editing around constraint validation and enforcement
Author: Robert Treat <[email protected]> Reviewed-by: jian he <[email protected]> Discussion: https://www.postgresql.org/message-id/flat/CACJufxFo4yTwzbSZrP%2BzQiR6_M00skoZMFaUnNJCdY6he%3DuQfA%40mail.gmail.com
1 parent 60dda7b commit 62a47ae

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

doc/src/sgml/ref/alter_table.sgml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -460,16 +460,16 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
460460
<para>
461461
This form adds a new constraint to a table using the same constraint
462462
syntax as <link linkend="sql-createtable"><command>CREATE TABLE</command></link>, plus the option <literal>NOT
463-
VALID</literal>, which is currently only allowed for foreign key,
464-
<literal>CHECK</literal> constraints and not-null constraints.
463+
VALID</literal>, which is currently only allowed for foreign-key,
464+
<literal>CHECK</literal>, and not-null constraints.
465465
</para>
466466

467467
<para>
468468
Normally, this form will cause a scan of the table to verify that all
469469
existing rows in the table satisfy the new constraint. But if
470470
the <literal>NOT VALID</literal> option is used, this
471471
potentially-lengthy scan is skipped. The constraint will still be
472-
enforced against subsequent inserts or updates (that is, they'll fail
472+
applied against subsequent inserts or updates (that is, they'll fail
473473
unless there is a matching row in the referenced table, in the case
474474
of foreign keys, or they'll fail unless the new row matches the
475475
specified check condition). But the
@@ -591,7 +591,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
591591
This form validates a foreign key, check, or not-null constraint that was
592592
previously created as <literal>NOT VALID</literal>, by scanning the
593593
table to ensure there are no rows for which the constraint is not
594-
satisfied. If the constraint is not enforced, an error is thrown.
594+
satisfied. If the constraint was set to <literal>NOT ENFORCED</literal>, an error is thrown.
595595
Nothing happens if the constraint is already marked valid.
596596
(See <xref linkend="sql-altertable-notes"/> below for an explanation
597597
of the usefulness of this command.)
@@ -1466,11 +1466,11 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
14661466
</para>
14671467

14681468
<para>
1469-
Adding an enforced <literal>CHECK</literal> or <literal>NOT NULL</literal>
1469+
Adding a <literal>CHECK</literal> or <literal>NOT NULL</literal>
14701470
constraint requires scanning the table to verify that existing rows meet the
14711471
constraint, but does not require a table rewrite. If a <literal>CHECK</literal>
1472-
constraint is added as <literal>NOT ENFORCED</literal>, the validation will
1473-
not be performed.
1472+
constraint is added as <literal>NOT ENFORCED</literal>, no verification will
1473+
be performed.
14741474
</para>
14751475

14761476
<para>
@@ -1485,7 +1485,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
14851485
</para>
14861486

14871487
<para>
1488-
Scanning a large table to verify a new foreign key or check constraint
1488+
Scanning a large table to verify new foreign-key, check, or not-null constraints
14891489
can take a long time, and other updates to the table are locked out
14901490
until the <command>ALTER TABLE ADD CONSTRAINT</command> command is
14911491
committed. The main purpose of the <literal>NOT VALID</literal>

0 commit comments

Comments
 (0)