Re: Avoid orphaned objects dependencies, take 3

From: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, Robert Haas <robertmhaas(at)gmail(dot)com>, Roman Eskin <r(dot)eskin(at)arenadata(dot)io>, Michael Paquier <michael(at)paquier(dot)xyz>, Alexander Lakhin <exclusion(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: Avoid orphaned objects dependencies, take 3
Date: 2026-06-09 06:47:06
Message-ID: aie26jMSoEMrHLaI@bdtpg
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Mon, Jun 08, 2026 at 02:55:19PM -0700, Jeff Davis wrote:
> On Fri, 2026-06-05 at 13:09 +0000, Bertrand Drouvot wrote:
> > the current patch
>
> /*
> * Look up a tracked aclcheck entry for the given object.
> * Returns true if found, filling in roleId, mode, and inval_count.
> * Searches from the end to find the most recent check (the one with
> the
> * freshest inval_count).
>
> What if two tracked ACL checks had different modes? Don't you need to
> do both checks or somehow combine the modes in the tracking entry?
>
> (I'm not sure if this is a practical problem or not.)

Humm, good point. I was focusing on a "full" role revoke but maybe what you
describe could be a practical problem (in case of privilege revoke from the
role).

In order to be on the safe side of things, the attached now iterates through all
matching entries (and not only the last one). It's still a flat array as its
linear scan is O(n) in the number of tracked entries, but that's fine since a
typical DDL statement tracks only a few objects.

Regards,

--
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

Attachment Content-Type Size
v25-0001-Recheck-permissions-after-lock-acquisition-in-de.patch text/x-diff 19.7 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Chao Li 2026-06-09 06:59:17 Re: First draft of PG 19 release notes
Previous Message Peter Smith 2026-06-09 06:41:46 Re: DOCS - Add missing EXCEPT parameter description to ALTER PUBLICATION