partition_doc_fixes.patch
application/octet-stream
Filename: partition_doc_fixes.patch
Type: application/octet-stream
Part: 0
Patch
Format: unified
| File | + | − |
|---|---|---|
| doc/src/sgml/ddl.sgml | 20 | 4 |
| doc/src/sgml/ref/alter_table.sgml | 11 | 2 |
diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml
index 498654876f..c4aaf906c7 100644
--- a/doc/src/sgml/ddl.sgml
+++ b/doc/src/sgml/ddl.sgml
@@ -3970,6 +3970,11 @@ ALTER TABLE measurement ATTACH PARTITION measurement_y2008m02
</programlisting>
</para>
+ <para>
+ The <command>ATTACH PARTITION</command> command requires taking a
+ <literal>SHARE UPDATE EXCLUSIVE</literal> lock on the partitioned table.
+ </para>
+
<para>
Before running the <command>ATTACH PARTITION</command> command, it is
recommended to create a <literal>CHECK</literal> constraint on the table to
@@ -3978,10 +3983,21 @@ ALTER TABLE measurement ATTACH PARTITION measurement_y2008m02
which is otherwise needed to validate the implicit
partition constraint. Without the <literal>CHECK</literal> constraint,
the table will be scanned to validate the partition constraint while
- holding both an <literal>ACCESS EXCLUSIVE</literal> lock on that partition
- and a <literal>SHARE UPDATE EXCLUSIVE</literal> lock on the parent table.
- It is recommended to drop the now-redundant <literal>CHECK</literal>
- constraint after <command>ATTACH PARTITION</command> is finished.
+ holding an <literal>ACCESS EXCLUSIVE</literal> lock on that partition
+ and all of its child partitions, if any. It is recommended to drop the
+ now-redundant <literal>CHECK</literal> constraint after the
+ <command>ATTACH PARTITION </command> is complete.
+ </para>
+
+ <para>
+ Similarly, if the partitioned table has a <literal>DEFAULT</literal>
+ partition, it is recommended to create a <literal>CHECK</literal>
+ constraint which excludes the to-be-attached partition's constraint. If
+ this is not done then the <literal>DEFAULT</literal> partition will be
+ scanned to verify that it contains no records which should be located in
+ the partition being attached. This operation will be performed whilst
+ holding an <literal>ACCESS EXCLUSIVE</literal> lock on the <literal>
+ DEFAULT</literal> partition and all of its sub-partitions, if any.
</para>
<para>
diff --git a/doc/src/sgml/ref/alter_table.sgml b/doc/src/sgml/ref/alter_table.sgml
index c5e5e84e06..281d26fe27 100644
--- a/doc/src/sgml/ref/alter_table.sgml
+++ b/doc/src/sgml/ref/alter_table.sgml
@@ -965,8 +965,17 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
<para>
Attaching a partition acquires a
<literal>SHARE UPDATE EXCLUSIVE</literal> lock on the parent table,
- in addition to <literal>ACCESS EXCLUSIVE</literal> locks on the table
- to be attached and on the default partition (if any).
+ in addition to the <literal>ACCESS EXCLUSIVE</literal> locks on the table
+ being attached and the default partition (if any).
+ </para>
+
+ <para>
+ Further locks must also be held on all sub-partitions if the table being
+ attached is itself a partitioned table. Likewise if the default
+ partition is itself a partitioned table. The locking of the
+ sub-partitions can be avoided by adding a <literal>CHECK</literal>
+ constraint as described in
+ <xref linkend="ddl-partitioning-declarative-maintenance"/>.
</para>
</listitem>
</varlistentry>