postgresql/src/bin
Stephen Frost e2090d9d20 pg_dump: Fix handling of ALTER DEFAULT PRIVILEGES
In commit 23f34fa, we changed how ACLs were handled to use the new
pg_init_privs catalog and to dump out the ACL commands as REVOKE+GRANT
combinations instead of trying to REVOKE all rights always and then
GRANT back just the ones which were in place.

Unfortunately, the DEFAULT PRIVILEGES system didn't quite get the
correct treatment with this change and ended up (incorrectly) only
including positive GRANTs instead of both the REVOKEs and GRANTs
necessary to preserve the correct privileges.

There are only a couple cases where such REVOKEs are possible because,
generally speaking, there's few rights which exist on objects by
default to be revoked.

Examples of REVOKEs which weren't being correctly preserved are when
privileges are REVOKE'd from the creator/owner, like so:

ALTER DEFAULT PRIVILEGES
  FOR ROLE myrole
  REVOKE SELECT ON TABLES FROM myrole;

or when other default privileges are being revoked, such as EXECUTE
rights granted to public for functions:

ALTER DEFAULT PRIVILEGES
  FOR ROLE myrole
  REVOKE EXECUTE ON FUNCTIONS FROM PUBLIC;

Fix this by correctly working out what the correct REVOKE statements are
(if any) and dump them out, just as we do for everything else.

Noticed while developing additional regression tests for pg_dump, which
will be landing shortly.

Back-patch to 9.6 where the bug was introduced.
2017-01-31 16:24:11 -05:00
..
initdb initdb: Fix for mixed-case superuser names 2017-01-19 16:17:36 -05:00
pg_archivecleanup pg_archivecleanup: Add NLS 2016-11-04 10:40:05 -04:00
pg_basebackup Add compression support to pg_receivexlog 2017-01-17 12:10:26 +01:00
pg_config Update copyright via script for 2017 2017-01-03 13:48:53 -05:00
pg_controldata Update copyright via script for 2017 2017-01-03 13:48:53 -05:00
pg_ctl pg_ctl: Change default to wait for all actions 2017-01-14 09:15:08 -05:00
pg_dump pg_dump: Fix handling of ALTER DEFAULT PRIVILEGES 2017-01-31 16:24:11 -05:00
pg_resetxlog Update copyright via script for 2017 2017-01-03 13:48:53 -05:00
pg_rewind Update copyright via script for 2017 2017-01-03 13:48:53 -05:00
pg_test_fsync pg_test_fsync: Add NLS 2016-11-04 10:40:05 -04:00
pg_test_timing pg_test_timing: Add NLS 2016-11-04 10:40:05 -04:00
pg_upgrade Change unknown-type literals to type text in SELECT and RETURNING lists. 2017-01-25 09:17:24 -05:00
pg_xlogdump pg_xlogdump: document --path behavior 2017-01-10 22:38:14 -05:00
pgbench Allow backslash line continuations in pgbench's meta commands. 2017-01-20 11:10:22 -05:00
pgevent Update copyright via script for 2017 2017-01-03 13:48:53 -05:00
psql Make psql reject attempts to set special variables to invalid values. 2017-01-30 16:37:26 -05:00
scripts Update copyright via script for 2017 2017-01-03 13:48:53 -05:00
Makefile Update copyright via script for 2017 2017-01-03 13:48:53 -05:00