Rethink pg_dump's handling of object ACLs.

Tom Lane <tgl@sss.pgh.pa.us>

Commit: 0c9d84427f441602425b0e18be5cfe751d1d8ebe
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2021-12-06T17:39:45Z
Releases: 15.0
Rethink pg_dump's handling of object ACLs.

Throw away most of the existing logic for this, as it was very
inefficient thanks to expensive sub-selects executed to collect
ACL data that we very possibly would have no interest in dumping.
Reduce the ACL handling in the initial per-object-type queries
to be just collection of the catalog ACL fields, as it was
originally.  Fetch pg_init_privs data separately in a single
scan of that catalog, and do the merging calculations on the
client side.  Remove the separate code path used for pre-9.6
source servers; there is no good reason to treat them differently
from newer servers that happen to have empty pg_init_privs.

Discussion: https://postgr.es/m/2273648.1634764485@sss.pgh.pa.us
Discussion: https://postgr.es/m/7d7eb6128f40401d81b3b7a898b6b4de@W2012-02.nidsa.loc

Files

PathChange+/−
src/bin/pg_dump/dumputils.c modified +203 −313
src/bin/pg_dump/dumputils.h modified +5 −9
src/bin/pg_dump/pg_dumpall.c modified +9 −50
src/bin/pg_dump/pg_dump.c modified +470 −729
src/bin/pg_dump/pg_dump.h modified +33 −36
src/fe_utils/string_utils.c modified +63 −0
src/include/fe_utils/string_utils.h modified +1 −0

Discussion