diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml index cbd4e40a320..018f6e3e08b 100644 --- a/doc/src/sgml/catalogs.sgml +++ b/doc/src/sgml/catalogs.sgml @@ -2629,7 +2629,6 @@ SCRAM-SHA-256$<iteration count>:&l Has the constraint been validated? - Currently, can be false only for foreign keys and CHECK constraints diff --git a/doc/src/sgml/ref/alter_table.sgml b/doc/src/sgml/ref/alter_table.sgml index d63f3a621ac..e47e7c4e3ef 100644 --- a/doc/src/sgml/ref/alter_table.sgml +++ b/doc/src/sgml/ref/alter_table.sgml @@ -243,7 +243,7 @@ WITH ( MODULUS numeric_literal, REM entire table; however, if a valid CHECK constraint is found which proves no NULL can exist, then the table scan is skipped. - If a column has an invalid not-null constraint, + If a column has an invalid NOT NULL constraint, SET NOT NULL validates it. @@ -459,9 +459,10 @@ 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. + syntax as CREATE TABLE, + plus the option NOT VALID, which is currently only + allowed for FOREIGN KEY, CHECK, + and NOT NULL constraints. @@ -469,7 +470,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 @@ -571,8 +572,8 @@ WITH ( MODULUS numeric_literal, REM These forms modify a inheritable constraint so that it becomes not - inheritable, or vice-versa. Only not-null constraints may be altered - in this fashion at present. + inheritable, or vice-versa. Only NOT NULL constraints + may be altered in this fashion at present. In addition to changing the inheritability status of the constraint, in the case where a non-inheritable constraint is being marked inheritable, if the table has children, an equivalent constraint @@ -588,10 +589,12 @@ WITH ( MODULUS numeric_literal, REM VALIDATE CONSTRAINT - This form validates a foreign key, check, or not-null constraint that was - previously created as NOT VALID, by scanning the + 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 created as + 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 +1469,11 @@ WITH ( MODULUS numeric_literal, REM - Adding an enforced 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 ENFORCED, the validation will - not be performed. + 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 ENFORCED, no verification is performed. @@ -1485,7 +1488,8 @@ 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