On Wed, Feb 25, 2026 at 10:36 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> So what you're saying is that I should have made the later branches
> do that also. I guess it's arguably better than dropping the grant
> altogether ... but the end result will be that the grant is now
> granted by the superuser running the restore, which doesn't seem
> very good either.
It does not, but it seems better than having a v16 pg_dumpall and v15
pg_dumpall produce non-logically-equivalent dumps of the same
database. My instinct is that this test:
if (PQgetisnull(res, i, i_grantor))
Should instead look like this:
if (PQgetisnull(res, i, i_grantor) &&
dump_grantors)
In v16+, if the grantor is not valid, that's unexpected and something
has gone wrong, perhaps due to insufficient locking, or maybe due to
catalog corruption. The warning is a fair response to a
seemingly-corrupted catalog state. But in v15-, this is just business
as usual; there's no particular expectation that the grantor must be a
valid role OID, and IMHO the best thing to do is give the same result
that a pre-v16 pg_dumpall would have produced.
I'm not actually completely confident that I have a fully correct
analysis of this problem. But I do think that it's hard to argue that
dumping the same database with different pg_dumpall versions should
produce logically different results.
--
Robert Haas
EDB: http://www.enterprisedb.com