Re: update ALTER TABLE with ATTACH PARTITION lock mode (docs)
Justin Pryzby <pryzby@telsasoft.com>
From: Justin Pryzby <pryzby@telsasoft.com>
To: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: Michael Paquier <michael@paquier.xyz>, Robert Haas <robertmhaas@gmail.com>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2019-10-29T03:56:33Z
Lists: pgsql-hackers
On Mon, Oct 28, 2019 at 12:06:44PM -0300, Alvaro Herrera wrote:
> On 2019-Oct-28, Michael Paquier wrote:
>
> > On Sun, Oct 27, 2019 at 07:12:07PM -0500, Justin Pryzby wrote:
> > > commit #898e5e32 (Allow ATTACH PARTITION with only ShareUpdateExclusiveLock)
> > > updates ddl.sgml but not alter_table.sgml, which only says:
> > >
> > > https://www.postgresql.org/docs/12/release-12.html
> > > |An ACCESS EXCLUSIVE lock is held unless explicitly noted.
> >
> > + <para>
> > + Attaching a partition acquires a <literal>SHARE UPDATE EXCLUSIVE</literal>
> > + lock on the partitioned table, in addition to an
> > + <literal>ACCESS EXCLUSIVE</literal> lock on the partition.
> > + </para>
> > Updating the docs of ALTER TABLE sounds like a good idea. This
> > sentence looks fine to me. Perhaps others have suggestions?
>
> Doesn't the command also acquire a lock on the default partition if
> there is one? It sounds worth noting.
I suppose it should something other than partition(ed), since partitions can be
partitioned, too...
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 child table and the
<literal>DEFAULT</literal> partition (if any).
Thanks,
Justin
Commits
-
Doc: Clarify locks taken when using ALTER TABLE ATTACH PARTITION
- 4d04031dd279 12.1 landed
- 2a4d96ebbd65 13.0 landed
-
Doc: Improve description around ALTER TABLE ATTACH PARTITION
- f5efc931c2e8 10.11 landed
- 8f8ff09d49af 11.6 landed
- a7207a24d40e 12.1 landed
- ea881338014f 13.0 landed