From: Justin Pryzby Date: Sun, 27 Oct 2019 18:38:23 -0500 Subject: [PATCH v1 2/2] Tweak language for ATTACH PARTITION docs --- doc/src/sgml/ddl.sgml | 8 ++++---- doc/src/sgml/ref/alter_table.sgml | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml index b097b80..8b60d8b 100644 --- a/doc/src/sgml/ddl.sgml +++ b/doc/src/sgml/ddl.sgml @@ -3972,14 +3972,14 @@ ALTER TABLE measurement ATTACH PARTITION measurement_y2008m02 Before running the ATTACH PARTITION command, it is recommended to create a CHECK constraint on the table to - be attached describing the desired partition constraint. That way, + be attached matching the desired partition constraint. That way, the system will be able to skip the scan which is otherwise needed to validate the implicit - partition constraint. Without such a constraint, the table will be + partition constraint. Without the CHECK constraint, the table will be scanned to validate the partition constraint while holding an ACCESS EXCLUSIVE lock on that partition and a SHARE UPDATE EXCLUSIVE lock on the parent table. - One may then drop the constraint after ATTACH PARTITION - is finished, because it is no longer necessary. + It may be desired to drop the redundant CHECK constraint + after ATTACH PARTITION is finished. diff --git a/doc/src/sgml/ref/alter_table.sgml b/doc/src/sgml/ref/alter_table.sgml index a184bed..91ec626 100644 --- a/doc/src/sgml/ref/alter_table.sgml +++ b/doc/src/sgml/ref/alter_table.sgml @@ -841,7 +841,7 @@ WITH ( MODULUS numeric_literal, REM or as a default partition by using DEFAULT. For each index in the target table, a corresponding one will be created in the attached table; or, if an equivalent - index already exists, will be attached to the target table's index, + index already exists, it will be attached to the target table's index, as if ALTER INDEX ATTACH PARTITION had been executed. Note that if the existing table is a foreign table, it is currently not allowed to attach the table as a partition of the target table if there @@ -864,17 +864,17 @@ WITH ( MODULUS numeric_literal, REM already exist. If any of the CHECK constraints of the table being attached are marked NO INHERIT, the command will fail; - such a constraint must be recreated without the NO INHERIT + such constraints must be recreated without the NO INHERIT clause. If the new partition is a regular table, a full table scan is performed - to check that no existing row in the table violates the partition + to check that existing rows in the table do not violate the partition constraint. It is possible to avoid this scan by adding a valid - CHECK constraint to the table that would allow only - the rows satisfying the desired partition constraint before running this - command. It will be determined using such a constraint that the table + CHECK constraint to the table that allows only + rows satisfying the desired partition constraint before running this + command. The CHECK constraint will be used to determine that the table need not be scanned to validate the partition constraint. This does not work, however, if any of the partition keys is an expression and the partition does not accept NULL values. If attaching -- 2.7.4 --xHFwDpU9dbj6ez1V--