Re: Relations being opened without any lock whatever

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Michael Paquier <michael@paquier.xyz>
Cc: pgsql-hackers@lists.postgresql.org
Date: 2018-10-01T00:08:28Z
Lists: pgsql-hackers
Michael Paquier <michael@paquier.xyz> writes:
> Okay, that's bad.  Wouldn't it be sufficient to use what the caller
> passes out as lockmode instead of enforcing AEL though?

No, because at the bottom of that function we're going to do a DROP
CONSTRAINT on the old FK constraint, and that needs AEL anyway.
If we tried to take a lesser lock first we'd just be creating a
lock-upgrade deadlock risk.

			regards, tom lane


Commits

  1. Fix tuple_data_split() to not open a relation without any lock.

  2. Lock relation used to generate fresh data for RMV.

  3. Fix ALTER COLUMN TYPE to not open a relation without any lock.