pgsql: Improve tracking of role dependencies of pg_init_privs entries.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Improve tracking of role dependencies of pg_init_privs entries.
Дата
Msg-id E1sJFj3-001uaA-Kt@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Improve tracking of role dependencies of pg_init_privs entries.

Commit 534287403 invented SHARED_DEPENDENCY_INITACL entries in
pg_shdepend, but installed them only for non-owner roles mentioned
in a pg_init_privs entry.  This turns out to be the wrong thing,
because there is nothing to cue REASSIGN OWNED to go and update
pg_init_privs entries when the object's ownership is reassigned.
That leads to leaving dangling entries in pg_init_privs, as
reported by Hannu Krosing.  Instead, install INITACL entries for
all roles mentioned in pg_init_privs entries (except pinned roles),
and change ALTER OWNER to not touch them, just as it doesn't
touch pg_init_privs entries.

REASSIGN OWNED will now substitute the new owner OID for the old
in pg_init_privs entries.  This feels like perhaps not quite the
right thing, since pg_init_privs ought to be a historical record
of the state of affairs just after CREATE EXTENSION.  However,
it's hard to see what else to do, if we don't want to disallow
dropping the object's original owner.  In any case this is
better than the previous do-nothing behavior, and we're unlikely
to come up with a superior solution in time for v17.

While here, tighten up some coding rules about how ACLs in
pg_init_privs should never be null or empty.  There's not any
obvious reason to allow that, and perhaps asserting that it's
not so will catch some bugs.  (We were previously inconsistent
on the point, with some code paths taking care not to store
empty ACLs and others not.)

This leaves recordExtensionInitPrivWorker not doing anything
with its ownerId argument, but we'll deal with that separately.

catversion bump forced because of change of expected contents
of pg_shdepend when pg_init_privs entries exist.

Discussion: https://postgr.es/m/CAMT0RQSVgv48G5GArUvOVhottWqZLrvC5wBzBa4HrUdXe9VRXw@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/35dd40d34cbdf5aa3e0f5b3493c33d00abb26456

Modified Files
--------------
doc/src/sgml/catalogs.sgml                         |   3 -
src/backend/catalog/aclchk.c                       | 130 ++++++++-
src/backend/catalog/pg_shdepend.c                  | 249 +++++++++++------
src/backend/utils/adt/acl.c                        |   6 +
src/include/catalog/catversion.h                   |   2 +-
src/include/catalog/dependency.h                   |   9 +-
src/include/utils/acl.h                            |   2 +
.../modules/test_pg_dump/expected/test_pg_dump.out | 305 +++++++++++++++++++++
src/test/modules/test_pg_dump/sql/test_pg_dump.sql |  71 +++++
9 files changed, 666 insertions(+), 111 deletions(-)


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

Предыдущее
От: Andrew Dunstan
Дата:
Сообщение: pgsql: Teach jsonpath string() to unwrap in lax mode
Следующее
От: Tom Lane
Дата:
Сообщение: pgsql: Fix insertion of SP-GiST REDIRECT tuples during REINDEX CONCURRE