model-writtenrun 729 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
Apr - Aug 2024 · 11 entries
- Bertrand Drouvot opened the thread with a general fix for concurrent CREATE and DROP leaving orphaned dependencies, following earlier discussions favoring conflicting locks on referenced objects; his initial patch locked and checked objects while recording dependencies #1.
- Alexander Lakhin demonstrated that the initial patch still allowed orphaned functions and crashes, prompting unconditional existence checks and a fallback for objects created by the current transaction; subsequent testing confirmed the repair and supplied broader concurrency scenarios #2 #6 #8 #9.
- The early discussion accepted that concurrent object lookup could still produce cache-lookup errors before dependency recording, while keeping this patch focused on preventing persistent orphaned dependencies #10 #11.
- Alexander then found that ALTER could move an object into a concurrently dropped schema, leading Bertrand to extend protection to changeDependencyFor() and add an ALTER test; Alexander confirmed that this fixed his reproduction #12 #13 #14.
- Michael Paquier requested moving the tests into the standard isolation suite and questioned internal-error reporting, while Alexander reinforced the SQLSTATE concern; Bertrand moved the tests and introduced a dedicated error code #15 #18 #19 #20.
- Robert Haas questioned hidden heavyweight locking in low-level dependency routines and explained that visibility of the current transaction's work required SnapshotSelf rather than a dirty snapshot, which Bertrand adopted #21 #23 #25 #26.
- After further discussion with Robert and Tom Lane, Bertrand moved locking toward dependency callers, added assertions that referenced objects were locked, and used command-counter increments instead of SnapshotSelf #27.
- Robert explained that locking inside renamed dependency helpers still obscured where locks were taken, prompting explicit class-and-OID locking throughout object-creation code, with some expression and text-search exceptions #28 #34.
- The review examined whether relation locks already protected referenced objects directly or indirectly; Bertrand first documented those guarantees, then chose to acquire a relation lock whenever none was held to avoid relying on incomplete assumptions #35 #40 #41 #42.
- Ashutosh Sharma measured increased lock usage with many user-defined types, but Robert argued that the example did not establish a realistic lock-table exhaustion problem, and Ashutosh agreed #37 #38 #39.
- Bertrand completed the explicit-locking approach by moving the remaining expression and text-search locking into more specific call sites, then maintained it through rebases from August 2024 into January 2025 #45 #46 #47 #48.
Jan - Feb 2025 · 1 entry
- Following the FOSDEM developer discussion, Bertrand removed getObjectDescription() from the locking helper and reported object identifiers in error detail instead, avoiding lookups of objects that might already have disappeared #49.
May - Jun 2025 · 2 entries
- Jeff Davis reopened the architectural discussion by defending centralized dependency locking and proposing a LOCKMODE argument as a compromise; Bertrand found that mixed sets of already-locked and unlocked dependencies made that interface difficult to use reliably #50 #52 #57.
- Robert identified the permission-check race as a potential correctness and security problem, and Bertrand's investigation confirmed that existing callers checked permissions both before and after dependency recording; they agreed to prioritize stale permission checks that could permit unauthorized catalog changes #58 #61 #63 #64.
Nov 2025 · 1 entry
- During the pause, Roman Eskin reported that Greengage customers encountered the same issue and that their implementation used centralized locking; Bertrand resumed the work in April 2026 #65 #66.
Apr - Jun 2026 · 12 entries
- Bertrand returned with three patches separating centralized orphan prevention, earlier locks at permission-check sites, and assertion-only tracking to detect missed cases, reducing the broad call-site changes of the previous approach #67.
- Robert questioned whether all dependencies required permission checks and whether nested utility calls could confuse tracking; Bertrand cited views whose execution privileges are checked later and added a newly exposed multirange namespace lock #68 #69.
- Heikki Linnakangas chose to land orphan prevention independently, noting the existing parallel mechanism for shared dependencies; he consolidated the helper into pg_depend.c, added the missing relation existence check, and revised errors and tests #70.
- Bertrand endorsed Heikki's revision and identified an unused include and formatting issues, which Heikki corrected before committing #71 #72.
- While preparing backports, Heikki discovered that table rewrites could record a dependency on a dropped column's InvalidOid datatype and committed a separate guard in AddNewAttributeTuples(), without posting an attached patch for that fix #72 f9d5a52da4.
- Heikki then committed Bertrand's orphan-prevention patch from #70 with light cleanup and renamed isolation tests, backpatching it through PostgreSQL 14 while leaving the permission-check work for further development #72 c8cd3d6976.
- Bertrand reworked the remaining permission problem into runtime tracking of ACL checks and invalidation counters, initially using a lock-and-retry loop; passing privilege information through every dependency API was rejected because expression walkers discover dependencies internally #73.
- Jeff pointed out that fixed object OIDs made the retry loop unnecessary and requested clearer design comments, leading to a simpler lock, existence-check, and permission-recheck sequence; name-resolution retries remained outside the patch's scope #74 #75 #76 #77.
- Jeff then identified that multiple checks could use different roles or privilege modes, and that nested utility calls could reset or mix tracking state; Bertrand changed the code to recheck every matching entry and preserve entries across nesting, adding isolation coverage #79 #80 #82 #83 #84.
- At Jeff's suggestion, Bertrand replaced the dedicated memory context and manual nesting bookkeeping with per-call tracking tables restored through PG_FINALLY; the same revision added successful-check-only tracking to avoid false foreign-key failures and column-level tracking to cover role-membership revocations #85 #86.
- Jeff remained concerned about false positives from checks inside aborted subtransactions and suggested detecting ACL changes instead; Bertrand noted that such an alternative would also need to track role membership #89 #90 #92.
- The final submission retained permission rechecks after an off-list decision that copying ACLs and role membership would be more fragile, adding subtransaction identifiers and abort cleanup; the four-patch permission series remained under review, with dedicated testing of the abort case still unresolved and eventual consolidation into one patch proposed #93.