]> git.ipfire.org Git - thirdparty/postgresql.git/commit
In pg_dumpall, don't skip role GRANTs with dangling grantor OIDs.
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 2 Mar 2026 16:14:58 +0000 (11:14 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 2 Mar 2026 16:15:10 +0000 (11:15 -0500)
commit74b4438a70b9a2ea654501ce061ae7dea1e6a2ea
tree895926051b60637163b6c3272abcf72958be3528
parent8b9d42bf6bd29b855a6bee21aa6010c070980086
In pg_dumpall, don't skip role GRANTs with dangling grantor OIDs.

In commits 29d75b25b et al, I made pg_dumpall's dumpRoleMembership
logic treat a dangling grantor OID the same as dangling role and
member OIDs: print a warning and skip emitting the GRANT.  This wasn't
terribly well thought out; instead, we should handle the case by
emitting the GRANT without the GRANTED BY clause.  When the source
database is pre-v16, such cases are somewhat expected because those
versions didn't prevent dropping the grantor role; so don't even
print a warning that we did this.  (This change therefore restores
pg_dumpall's pre-v16 behavior for these cases.)  The case is not
expected in >= v16, so then we do print a warning, but soldiering on
with no GRANTED BY clause still seems like a reasonable strategy.

Per complaint from Robert Haas that we were now dropping GRANTs
altogether in easily-reachable scenarios.

Reported-by: Robert Haas <robertmhaas@gmail.com>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CA+TgmoauoiW4ydDhdrseg+DD4Kwha=+TSZp18BrJeHKx3o1Fdw@mail.gmail.com
Backpatch-through: 16
src/bin/pg_dump/pg_dumpall.c