Re: DROP ROLE blocked by pg_init_privs

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: immerrr again <immerrr(at)gmail(dot)com>
Cc: Pavel Luzanov <p(dot)luzanov(at)postgrespro(dot)ru>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: DROP ROLE blocked by pg_init_privs
Date: 2025-11-26 00:08:05
Message-ID: 1484313.1764115685@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general

immerrr again <immerrr(at)gmail(dot)com> writes:
> Sorry, nvm, I forgot to drop the privileges in the repro. Can confirm, with
> 16.9 it works as expected:
> ...
> The same script with postgres:17 image fails with the error I have been
> describing:

The missing step here is

DROP OWNED BY test_role;

You have to use that to get rid of "initial privileges" because
neither REVOKE nor ALTER DEFAULT PRIVILEGES will touch existing
initial privileges. Pre-v17 didn't account for this properly
and would allow you to drop the role anyway, leaving dangling
entries behind in pg_init_privs. While those are harmless in
isolation, they cause problems for later dump/restore activity.

See discussion here:

https://stream.boxwatch.ru/message-id/flat/1745535.1712358659%40sss.pgh.pa.us

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message immerrr again 2025-11-26 00:33:47 Re: DROP ROLE blocked by pg_init_privs
Previous Message immerrr again 2025-11-25 23:06:39 Re: DROP ROLE blocked by pg_init_privs