Re: Handle concurrent drop when doing whole database vacuum - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: Handle concurrent drop when doing whole database vacuum
Date
Msg-id ajzIjd8sb2wiIXs5@paquier.xyz
Whole thread
In response to Re: Handle concurrent drop when doing whole database vacuum  ("cca5507" <cca5507@qq.com>)
Responses Re: Handle concurrent drop when doing whole database vacuum
Re: Handle concurrent drop when doing whole database vacuum
List pgsql-hackers
On Thu, Jun 25, 2026 at 01:53:39PM +0800, cca5507 wrote:
> I think the current one is ok, so I didn't change this.

+ * Note: this function is called without holding a relation lock for database-wide
+ * VACUUM or ANALYZE, so the relation can be dropped concurrently. In that
+ * case, issue a WARNING and return false.

FWIW, even after sleeping on it, I don't think that this patch is
going in the right direction.  I am pretty sure that we should just
lift the ACL check in get_all_vacuum_rels() and always require
vacuum_is_permitted_for_relation() to have the relation locked when
called.  This way we would rely on one single code path for the ACL
check, even if it means holding a reference of a relation OID for
something to be processsed later.  So I would revisit the choice made
in a556549d7e6d.  The isolation test vacuum-conflict also seems OK
with this shortcut, after a quick test, which was the kind of patterns
this commit is after.
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Chao Li
Date:
Subject: Re: psql: add tab completion for subscription wal_receiver_timeout
Next
From: Kirill Reshke
Date:
Subject: psql internals queries breaks in presence of user-defined operators