Re: Avoid orphaned objects dependencies, take 3
Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
From: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
To: Jeff Davis <pgsql@j-davis.com>
Cc: Heikki Linnakangas <hlinnaka@iki.fi>, Robert Haas <robertmhaas@gmail.com>, Roman Eskin <r.eskin@arenadata.io>, Michael Paquier <michael@paquier.xyz>, Alexander Lakhin <exclusion@gmail.com>, pgsql-hackers@lists.postgresql.org, Tom Lane <tgl@sss.pgh.pa.us>
Date: 2026-06-10T12:31:04Z
Lists: pgsql-hackers
Attachments
Hi, On Tue, Jun 09, 2026 at 02:44:10PM -0700, Jeff Davis wrote: > Hi, > > On Tue, 2026-06-09 at 06:47 +0000, Bertrand Drouvot wrote: > > In order to be on the safe side of things, the attached now iterates > > through all > > matching entries (and not only the last one). > > I don't think: > > if (context == PROCESS_UTILITY_TOPLEVEL) > > is quite right. > > In any case, I don't think mixing the tracking entries between entirely > different DDL commands is a good idea. If you execute DDL inside of SPI > in its own subtransaction, and it inserts a tracking entry to recheck > something, and then you roll back the subxact, you don't want the > tracking entry to then cause the outer transaction to fail. I didn't > test this, so if there's something preventing this kind of problem, let > me know. > > We probably need to track where we are in the stack of ProcessUtility() > calls and keep the tracking entries separate, and always remove entries > from that level on return (or rollback). I think you are right. I changed this in the attached so that aclcheck_tracked_count is saved on entry and restored on return of each ProcessUtility call, so that each nesting level's entries are kept separate. Also, the reset is now done whenever tracking is initialized (means at the outermost ProcessUtility call that starts tracking). I think that addresses your concerns and it also fixes the issues reported by the cfbot (that I mentioned up-thread). I also added more tests related to nested calls. Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Avoid orphaned objects dependencies
- 2fbb21170e90 19 (unreleased) landed
- 5100bdbd3ba2 14 (unreleased) landed
- 5fa137727db0 15 (unreleased) landed
- d9bc0d96c247 16 (unreleased) landed
- 3a9909eda207 17 (unreleased) landed
- c8cd3d6976f7 18 (unreleased) landed
-
Don't try to record dependency on a dropped column's datatype
- fd93ee100830 19 (unreleased) landed
- 36b6ed2606e1 14 (unreleased) landed
- ef3d7b15e4cd 15 (unreleased) landed
- d44cd467471c 16 (unreleased) landed
- c1588f92a915 17 (unreleased) landed
- f9d5a52da4ca 18 (unreleased) landed