pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Pg Hackers <pgsql-hackers@lists.postgresql.org>
Subject: document lock obtained for FKs during detach
Date: Thu, 25 Mar 2021 15:02:44 -0300
Message-ID: <20210325180244.GA12738@alvherre.pgsql> (raw)

I failed to document the lock acquired on tables that reference the
partitioned table that we're detaching a partition from.  This patch
(proposed for backpatch to 12, where that feature was added) fixes that
problem.

Noticed the omission a week ago while working out some details of
concurrent detach.

-- 
Álvaro Herrera                            39°49'30"S 73°17'W
"It takes less than 2 seconds to get to 78% complete; that's a good sign.
A few seconds later it's at 90%, but it seems to have stuck there.  Did
somebody make percentages logarithmic while I wasn't looking?"
                http://smylers.hates-software.com/2005/09/08/1995c749.html

Attachments:

0001-Document-lock-obtained-during-partition-detach.patch (text/x-diff, 1.2K) download From 98c0fe1d22333ea4ec27256f9c4dda98b1166b65 Mon Sep 17 00:00:00 2001 From: Alvaro Herrera <alvherre@alvh.no-ip.org> Date: Thu, 25 Mar 2021 14:53:21 -0300 Subject: [PATCH] Document lock obtained during partition detach We acquire a SHARE lock all table that reference the partitioned table that we're detaching a partition from, but failed to document this fact. My oversight in commit f56f8f8da6af. Repair. Backpatch to 12. --- doc/src/sgml/ref/alter_table.sgml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/src/sgml/ref/alter_table.sgml b/doc/src/sgml/ref/alter_table.sgml index 0bd0c1a503..cd56d6a17e 100644 --- a/doc/src/sgml/ref/alter_table.sgml +++ b/doc/src/sgml/ref/alter_table.sgml @@ -962,6 +962,8 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM ties to the table from which it was detached. Any indexes that were attached to the target table's indexes are detached. Any triggers that were created as clones of those in the target table are removed. + <literal>SHARE</literal> lock is obtained on any tables that reference + this partitioned table in foreign key constraints. </para> </listitem> </varlistentry> -- 2.20.1

Message-ID: <20210325180244.GA12738@alvherre.pgsql>
Permalink:  ../20210325180244.GA12738@alvherre.pgsql/
Also on:    postgresql.org/message-id/20210325180244.GA12738@alvherre.pgsql

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: alvherre@alvh.no-ip.org
  Subject: Re: document lock obtained for FKs during detach
  In-Reply-To: <20210325180244.GA12738@alvherre.pgsql>
  References: <20210325180244.GA12738@alvherre.pgsql>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox