postgresql/src
Stephen Frost eb5e9d90df 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:14 -05:00
..
backend Handle ALTER EXTENSION ADD/DROP with pg_init_privs 2017-01-29 23:05:09 -05:00
bin pg_dump: Fix handling of ALTER DEFAULT PRIVILEGES 2017-01-31 16:24:14 -05:00
common pgindent run for 9.6 2016-06-09 18:02:36 -04:00
fe_utils Restore psql's SIGPIPE setting if popen() fails. 2016-12-07 12:39:24 -05:00
include Handle ALTER EXTENSION ADD/DROP with pg_init_privs 2017-01-29 23:05:09 -05:00
interfaces Fix buffer overflow on particularly named files and clarify documentation about 2016-12-22 08:29:13 +01:00
makefiles Fix typos in comments and doc 2016-01-28 16:47:36 +09:00
pl Be more careful about Python refcounts while creating exception objects. 2016-12-09 15:27:23 -05:00
port Make pgwin32_putenv() visit debug CRTs. 2016-12-03 15:46:42 -05:00
template Remove some remains from Alpha support removal 2015-10-29 16:40:14 -04:00
test test_pg_dump: perltidy cleanup 2017-01-31 11:17:40 -05:00
timezone Update time zone data files to tzdata release 2016j. 2017-01-30 11:40:39 -05:00
tools Change qr/foo$/m to qr/foo\n/m, for Perl 5.8.8. 2016-11-07 20:27:35 -05:00
tutorial Update copyright for 2016 2016-01-02 13:33:40 -05:00
.gitignore Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:04 +02:00
bcc32.mak Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00
DEVELOPERS Replace a couple of references to files that no longer exist in the source 2009-05-04 08:08:47 +00:00
Makefile Install TAP test infrastructure so it's available for extension testing. 2016-09-23 15:50:00 -04:00
Makefile.global.in Make TAP test suites to work, when @INC does not contain current dir. 2016-10-07 22:01:04 +03:00
Makefile.shlib Fix misstatement in comment in Makefile.shlib. 2016-10-01 13:45:23 -04:00
nls-global.mk nls-global.mk: search build dir for source files, too 2016-06-07 18:55:18 -04:00
win32.mak Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00