From: Tom Lane <tgl@sss.pgh.pa.us>
To: Paul Jungwirth <pj@illuminatedcomputing.com>
Cc: pgsql-general@postgresql.org <pgsql-general@postgresql.org>
Subject: Re: Full table lock dropping a foreign key
Date: Wed, 05 Sep 2018 14:02:24 -0400
Message-ID: <1370.1536170544@sss.pgh.pa.us> (raw)
In-Reply-To: <5cfcdc5c-79db-98ed-6596-bc1fbae3ac10@illuminatedcomputing.com>
References: <5cfcdc5c-79db-98ed-6596-bc1fbae3ac10@illuminatedcomputing.com>
Paul Jungwirth <pj@illuminatedcomputing.com> writes:
> I noticed that Postgres takes an AccessExclusiveLock (a lock on the
> whole table) against the *referenced* table when dropping a foreign key.
Yeah, that's because it involves removing a trigger.
Adding a trigger used to require AEL as well, but it was successfully
argued that that end of things could use a weaker lock. I find the
reasoning rather dubious myself.
regards, tom lane
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-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, pj@illuminatedcomputing.com
Subject: Re: Full table lock dropping a foreign key
In-Reply-To: <1370.1536170544@sss.pgh.pa.us>
References: <5cfcdc5c-79db-98ed-6596-bc1fbae3ac10@illuminatedcomputing.com> <1370.1536170544@sss.pgh.pa.us>
* 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