model-writtenrun 1247 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Virender Singla reported that concurrent role grants and role deletion could leave dangling pg_auth_members entries and make pg_upgrade fail on an empty quoted identifier; Laurenz Albe suggested locking the referenced role, and Virender supplied another reproduction involving deletion of the granted role #1 #2 #3.
- Tom Lane found that locking existed but the required existence recheck was missing, and posted a patch adding shared dependencies on the granted role and member; this also made DROP OWNED remove their memberships, while existing DROP ROLE cleanup was retained #4.
- Alvaro Herrera proposed making pg_dumpall skip invalid grants to handle existing catalog inconsistencies, and Tom chose explicit warnings instead of silently filtering entries through inner joins #5 #6 #7.
- Tom expanded the work into a two-patch series with backend tests and documentation plus the pg_dumpall workaround; he manually tested the dump changes by deleting catalog entries but left broader automated dumpRoleMembership coverage unaddressed #7.
- Laurenz reviewed both patches, advised against backpatching the dependency change, and questioned the command-counter adjustment; Tom explained that newly created roles must become visible before their default grants acquire dependencies #8 #9.
- The dump portion landed as 5302ff95ca, adapting #7 to the supplied commit's older loop while preserving its existing missing-grantor behavior, with the fix backpatched through PostgreSQL 13.
- After Laurenz accepted simplifying the command-counter logic, Tom committed the backend portion of #7 with an unconditional CommandCounterIncrement as 98fc31d649; the dependency and DROP OWNED behavior changes were kept out of stable branches, without requiring a development-branch catalog-version bump #11 #12 #13.
- About a year later, Robert Haas reported that newer pg_dumpall versions omitted valid memberships when dumping older servers whose grantor roles had been dropped, even though those dumps would not use GRANTED BY anyway #15.
- Robert argued that missing grantors were readily reachable on pre-16 servers, while Tom worried that restoring without the original grantor changed ownership semantics; they converged on preserving the GRANT and distinguishing missing grantors from missing roles or members in diagnostics #17 #18 #19 #21 #23.
- On inspecting the code, Tom retained the policy of omitting all grantors from pre-16 sources and therefore dropped the proposed informational message for those sources; his corrective patch preserved grants, warned about missing grantors only for newer sources, and clarified the other missing-role warnings #25 #26.
- Robert reviewed the corrective patch and requested a clearer variable name; he also explained that retaining old grantor information could produce invalid grant trees on newer servers, so Tom left that broader policy unchanged #27 #28 #29.
- Tom committed #26 with the requested dump_this_grantor name and branch adaptations as a4649c50a8, backpatched through PostgreSQL 16, and announced completion #30.
- The thread ended with Robert's thanks, with all submitted fixes landed and no patch awaiting review; reconsideration of pre-16 grantor preservation remained outside this work #28 #31.