agora inbox for pgsql-hackers@postgresql.org  
help / color / mirror / Atom feed
From: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
To: Jeff Davis <pgsql@j-davis.com>
Cc: Heikki Linnakangas <hlinnaka@iki.fi>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Roman Eskin <r.eskin@arenadata.io>
Cc: Michael Paquier <michael@paquier.xyz>
Cc: Alexander Lakhin <exclusion@gmail.com>
Cc: pgsql-hackers@lists.postgresql.org, Tom Lane <tgl@sss.pgh.pa.us>
Subject: Re: Avoid orphaned objects dependencies, take 3
Date: Fri, 5 Jun 2026 13:12:34 +0000
Message-ID: <aiLLQsQIEd7CKpYY@bdtpg> (raw)
In-Reply-To: <44220da166d8f1ef74b2bf76c60a7663dcf9dc07.camel@j-davis.com>
References: <ad/awXLnMuc6Rf5M@bdtpg>
	<afCXPVNuvpf5ECGZ@bdtpg>
	<CA+TgmobtzkG9HzGtDXbgb3KVE46qHuSvGcuKHgAGQ1aejCoLLw@mail.gmail.com>
	<agsCqlLTytZCudMv@bdtpg>
	<aebf583b-b904-4035-a1c1-a4c5ad064dec@iki.fi>
	<ahYAKgbx05IQdjwR@bdtpg>
	<3963e573-4852-4d25-b741-7c5c7e1f9140@iki.fi>
	<ah1PIyqtT+427dWb@bdtpg>
	<5315d15a42109297259d1a3264ad09e363eb98df.camel@j-davis.com>
	<44220da166d8f1ef74b2bf76c60a7663dcf9dc07.camel@j-davis.com>

Hi,

On Thu, Jun 04, 2026 at 10:17:57AM -0700, Jeff Davis wrote:
> Given that we don't do another name lookup, the object Oid doesn't
> change, and it's not obvious why we need a loop in this path.
> 
> A sequence like:
> 
> Earlier during DDL processing:
>   0. Name lookup and ACL check (and track ACLs)
> 
> When recording dependencies:
>   1. Lock object
>   2. Check that it still exists, error if not
>   3. recheck tracked ACLs, error if failure
> 
> could work too, right?

Yeah, that's a good point, thanks!

> I see why you might want to do the checks while not holding the lock,
> but it doesn't seem like a requirement (if the user doesn't have
> permissions it should fail quickly and release).

I agree that we can get rid of the loop and that's what v24 shared up-thread [1]
is now implementing. The downside is that one could take a lock on an object
he has no privileges on but then, as you said, it will be released shortly after.

[1]: https://postgr.es/m/aiLKkTC6QBt8i35P%40bdtpg

Regards,

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





view thread (93+ messages)  latest in thread

Message-ID: <aiLLQsQIEd7CKpYY@bdtpg>
Permalink:  ../aiLLQsQIEd7CKpYY@bdtpg/
Also on:    postgresql.org/message-id/aiLLQsQIEd7CKpYY@bdtpg

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: bertranddrouvot.pg@gmail.com, pgsql@j-davis.com, hlinnaka@iki.fi, robertmhaas@gmail.com, r.eskin@arenadata.io, michael@paquier.xyz, exclusion@gmail.com, tgl@sss.pgh.pa.us
  Subject: Re: Avoid orphaned objects dependencies, take 3
  In-Reply-To: <aiLLQsQIEd7CKpYY@bdtpg>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox