diff options
author | David Rowley <drowley@postgresql.org> | 2021-07-28 15:01:40 +1200 |
---|---|---|
committer | David Rowley <drowley@postgresql.org> | 2021-07-28 15:01:40 +1200 |
commit | aa1e9211ecf7ef410b4313f0e061de087aed0aa2 (patch) | |
tree | faa726c35ec8df256b3061fa09e84df5b9d0638d /doc/src/sgml/ref/alter_table.sgml | |
parent | b8f91d7f926368115c27b978c939174c96df1a5f (diff) |
Doc: Clarify lock levels taken during ATTACH PARTITION
It wasn't all that clear which lock levels, if any, would be held on the
DEFAULT partition during an ATTACH PARTITION operation.
Also, clarify which locks will be taken if the DEFAULT partition or the
table being attached are themselves partitioned tables.
Here I'm only backpatching to v12 as before then we obtained an ACCESS
EXCLUSIVE lock on the partitioned table. It seems much less relevant to
mention which locks are taken on other tables when the partitioned table
itself is locked with an ACCESS EXCLUSIVE lock.
Author: Matthias van de Meent, David Rowley
Discussion: https://postgr.es/m/CAEze2WiTB6iwrV8W_J=fnrnZ7fowW3qu-8iQ8zCHP3FiQ6+o-A@mail.gmail.com
Backpatch-through: 12
Diffstat (limited to 'doc/src/sgml/ref/alter_table.sgml')
-rw-r--r-- | doc/src/sgml/ref/alter_table.sgml | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/doc/src/sgml/ref/alter_table.sgml b/doc/src/sgml/ref/alter_table.sgml index 68ef3e9b4f3..beae516f3d1 100644 --- a/doc/src/sgml/ref/alter_table.sgml +++ b/doc/src/sgml/ref/alter_table.sgml @@ -934,8 +934,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 on 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> |