Re: incorrect pg_dump output due to not handling dropped roles correctly

Stephen Frost <[email protected]>
Newsgroups gmane.comp.db.postgresql.bugs
Message-ID <[email protected]>
Greetings Michael,

* Michael Paquier ([email protected]) wrote:
> On Mon, Nov 18, 2019 at 09:16:06AM +0000, Floris Van Nee wrote:
> > So, if we do it during DROP OWNED BY, we should also handle it
> > during one of the below REVOKE commands. Perhaps DROP OWNED BY
> > already calls one of these functions internally - in that case you
> > can ignore my comment. Just wanted to make sure we catch all
> > possible cases this can occur. 
> 
> One problem here is that you would need to scan and track down all the
> entries in pg_init_privs if you'd like to make sure that all the
> traces of the role have been removed, so that's really not good for
> performance.  The fix I was actually imagining upthread would be to
> add a new type of entry in pg_shdepend linking the role with
> pg_init_privs for the object where an ACL is added.  This would
> prevent DROP ROLE to complete with your scenarios, and if the role
> ownerships are dropped we could use the link between the object and
> the role to remove directly the ACL for the role in the object.
> That's not really backpatchable unfortunately.  On top of the new
> pg_depend type we would need a new cleanup routine similar to what
> happens for policy ACLs when dropping a role.

Please review the message I just posted on this thread in response to
the original complaint.  I really don't think we want these entries to
end up in pg_init_privs in the first place and all of this around the
dependency handling is, at best, an independent thing and not actually
the root cause of this problem that we should be addressing.

I'm not sure that there's a case where this dependency handling would
actually be needed that's being described here, assuming we address the
root issue that these entries are being added in the first place- maybe
there is if an extension's .sql script has a built-in assumption that
some role already exists and then a user goes and drops that role, but
it seems like the right answer there might be to require the user to
drop the extension itself and not the role and we should track the
dependency that way.

Thanks,

Stephen
signature.asc (application/pgp-signature, 819 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBCgAGBQJd5sYbAAoJEO1sijiDR2RVIEUQAJsMJFX7O8g1C/s/1oD3Q4iy
YPxZcikker5HKxHjkPuIl14SIFEt1lp0DbPKbZnC2XUZQxHjQtMK4jSyCnl/qWDu
8ZUZzdpRPCbrlQJPSZn5Sla6fUvYVeP9smxLdGPA+TCqM6GmtlofPXFlsti9n9mJ
XdkQCJwsU6iIvqHisuqOWKdZKn8ClYYIb92fUI2rTX+IEOsTqfCuOsJvsBMzaPXf
NtXm4UJAik/c9XQIdOf8DfChC/Ojf8+0b3u/dDLdBe8j6yl8/ZDYNufrbSBMOkhn
z6gyyqZgWwBd3MlPy2lP5SW3a1ocHOZgomrkPgrDOL9oo0UCKo6yAMLau1OGt0Ee
S12oSihky51p0eTHhEZPoXRDzMNh+/THgQke2H0vt425ee6/6+WmSILFITTfpmSx
MgaAlXFpPcRwODnnRYY706PE6FRKXq9eTvg+zuGsyUo4uLSvvJ1dbj8XEJUWUG3K
B8a7GTcG6Ie2N9OTnV2gdxnQtnvIiN24l+ZPLeoePCoLebGwNmtk01FjD8rUdTJ4
Otrf2fK1ZvzilvK1gz74l8JFDt5ZMh/nIJ2/C8UR7Kjw9CoVtSj812lBR4eqNmkZ
ps2ubhfsWCQ8kFBspUPzTJeLkQ9cNur5OzJrjrvj/7hiWr/gA3pGQJ8R1/UjzR0J
yKadOGU76kAX4+A0LeCa
=h+ss
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.