doc: Some copy-editing around constraint validation and enforcement
authorPeter Eisentraut
Wed, 25 Jun 2025 10:44:03 +0000 (12:44 +0200)
committerPeter Eisentraut
Wed, 25 Jun 2025 10:46:16 +0000 (12:46 +0200)
Author: Robert Treat 
Reviewed-by: jian he
Discussion: https://www.postgresql.org/message-id/flat/CACJufxFo4yTwzbSZrP%2BzQiR6_M00skoZMFaUnNJCdY6he%3DuQfA%40mail.gmail.com

doc/src/sgml/ref/alter_table.sgml

index d63f3a621acc6e7765c1375caa7ffb46a5b32429..d16969916835d7a6eb47c90523a9b72f633b16b6 100644 (file)
@@ -460,8 +460,8 @@ WITH ( MODULUS numeric_literal, REM
      
       This form adds a new constraint to a table using the same constraint
       syntax as CREATE TABLE, plus the option NOT
-      VALID, which is currently only allowed for foreign key,
-      CHECK constraints and not-null constraints.
+      VALID, which is currently only allowed for foreign-key,
+      CHECK, and not-null constraints.
      
 
      
@@ -469,7 +469,7 @@ WITH ( MODULUS numeric_literal, REM
       existing rows in the table satisfy the new constraint.  But if
       the NOT VALID option is used, this
       potentially-lengthy scan is skipped.  The constraint will still be
-      enforced against subsequent inserts or updates (that is, they'll fail
+      applied against subsequent inserts or updates (that is, they'll fail
       unless there is a matching row in the referenced table, in the case
       of foreign keys, or they'll fail unless the new row matches the
       specified check condition).  But the
@@ -591,7 +591,7 @@ WITH ( MODULUS numeric_literal, REM
       This form validates a foreign key, check, or not-null constraint that was
       previously created as NOT VALID, by scanning the
       table to ensure there are no rows for which the constraint is not
-      satisfied.  If the constraint is not enforced, an error is thrown.
+      satisfied.  If the constraint was set to NOT ENFORCED, an error is thrown.
       Nothing happens if the constraint is already marked valid.
       (See  below for an explanation
       of the usefulness of this command.)
@@ -1466,11 +1466,11 @@ WITH ( MODULUS numeric_literal, REM
    
 
    
-    Adding an enforced CHECK or NOT NULL
+    Adding a CHECK or NOT NULL
     constraint requires scanning the table to verify that existing rows meet the
     constraint, but does not require a table rewrite.  If a CHECK
-    constraint is added as NOT ENFORCEDthe validation will
-    not be performed.
+    constraint is added as NOT ENFORCEDno verification will
+    be performed.
    
 
    
@@ -1485,7 +1485,7 @@ WITH ( MODULUS numeric_literal, REM
    
 
    
-    Scanning a large table to verify a new foreign key or check constraint
+    Scanning a large table to verify new foreign-key, check, or not-null constraints
     can take a long time, and other updates to the table are locked out
     until the ALTER TABLE ADD CONSTRAINT command is
     committed.  The main purpose of the NOT VALID