[COMMITTERS] pgsql: pg_dump: Fix handling of ALTER DEFAULT PRIVILEGES

Поиск
Список
Период
Сортировка
От Stephen Frost
Тема [COMMITTERS] pgsql: pg_dump: Fix handling of ALTER DEFAULT PRIVILEGES
Дата
Msg-id E1cYfut-0003ce-2S@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
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.

Branch
------
REL9_6_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/eb5e9d90df7536d0cf5c0d669d874f91b7be36d6

Modified Files
--------------
src/bin/pg_dump/dumputils.c | 23 ++++++++++++-----
src/bin/pg_dump/dumputils.h |  4 ++-
src/bin/pg_dump/pg_dump.c   | 63 ++++++++++++++++++++++++++++++++++++++++-----
src/bin/pg_dump/pg_dump.h   |  3 +++
4 files changed, 78 insertions(+), 15 deletions(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Stephen Frost
Дата:
Сообщение: [COMMITTERS] pgsql: perltidy pg_dump TAP tests
Следующее
От: Alvaro Herrera
Дата:
Сообщение: [COMMITTERS] pgsql: Tweak catalog indexing abstraction for upcoming WARM