Re: incorrect pg_dump output due to not handling dropped rolescorrectly

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: incorrect pg_dump output due to not handling dropped rolescorrectly
Дата
Msg-id 20191118041433.GB1543@paquier.xyz
обсуждение исходный текст
Ответ на Re: incorrect pg_dump output due to not handling dropped rolescorrectly  (Michael Paquier <michael@paquier.xyz>)
Ответы Re: incorrect pg_dump output due to not handling dropped rolescorrectly  (Floris Van Nee <florisvannee@Optiver.com>)
Список pgsql-bugs
On Mon, Nov 18, 2019 at 12:10:59PM +0900, Michael Paquier wrote:
> The dependencies related to the ACL entries exist in pg_shdepend
> between the role and the revoked objects, and these get removed when
> issuing DROP OWNED BY.  So it seems to me that the cleanup needs to
> happen when issuing the DROP OWNED BY query, and not DROP ROLE.
> Looking at the code, it seems to me that we should just patch
> shdepDropOwned() to handle properly the removal of the role in ACL
> objects in pg_init_privs for all the objects we are removing a
> dependency on.  I am just diving into a patch..

Okay, I have been looking more at the code and as CREATE EXTENSION has
been creating the entry depending on the role, I would tend to think
that the simplest solution is that for each SHARED_DEPENDENCY_ACL we
should call a new routine, say RemoveRoleFromInitPriv(), which would
check for the presence of the object whose dependency is removed in
pg_init_privs and then remove from the ACL item list any trace of the
role whose ownerships are dropped.  The removal would require a logic
similar to what is done in RemoveRoleFromObjectPolicy(), where the
previous ACL is rebuilt but without the role removed.

It may be cleaner to invent a new type of dependency for pg_shdepend,
say SHARED_DEPENDENCY_INIT_PRIVS which would remove the dependency to
the object in pg_init_privs but that would not be backpatchable :(

Tom, any thoughts perhaps?
--
Michael

Вложения

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

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: incorrect pg_dump output due to not handling dropped rolescorrectly
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: BUG #16122: segfault pg_detoast_datum (datum=0x0) at fmgr.c:1833numrange query