pgsql: Lock the extension during ALTER EXTENSION ADD/DROP.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Lock the extension during ALTER EXTENSION ADD/DROP.
Date: 2021-07-11 16:54:58
Message-ID: E1m2cjK-0001cW-17@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Lock the extension during ALTER EXTENSION ADD/DROP.

Although we were careful to lock the object being added or dropped,
we failed to get any sort of lock on the extension itself. This
allowed the ALTER to proceed in parallel with a DROP EXTENSION,
which is problematic for a couple of reasons. If both commands
succeeded we'd be left with a dangling link in pg_depend, which
would cause problems later. Also, if the ALTER failed for some
reason, it might try to print the extension's name, and that could
result in a crash or (in older branches) a silly error message
complaining about extension "(null)".

Per bug #17098 from Alexander Lakhin. Back-patch to all
supported branches.

Discussion: https://postgr.es/m/17098-b960f3616c861f83@postgresql.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/626731db26ae2617e41536678440c3817128a006

Modified Files
--------------
src/backend/commands/extension.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2021-07-12 02:13:58 pgsql: pageinspect: Improve page_header() for pages of 32kB
Previous Message Thomas Munro 2021-07-11 08:14:50 pgsql: Fix pgbench timestamp bugs.