agora inbox for pgsql-bugs@postgresql.org  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: ext.solutec.sperraud@grandlyon.com
Subject: BUG #19682: Unable to drop a user with default privileges revoked
Date: Wed, 09 Sep 2026 09:29:50 +0000
Message-ID: <19682-21342a50fcf153e5@postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      19682
Logged by:          Sylvain Perraud
Email address:      ext.solutec.sperraud@grandlyon.com
PostgreSQL version: 18.4
Operating system:   RHEL 9.8
Description:        

Hello,

Scenario 1 : create a user alpha then grant default privileges to himself

test=# create user alpha;
CREATE ROLE
test=# \ddp alpha
         Default access privileges
 Owner | Schema | Type | Access privileges
-------+--------+------+-------------------
(0 rows)

test=#  ALTER DEFAULT PRIVILEGES FOR ROLE alpha GRANT ALL ON TABLES to
alpha;
ALTER DEFAULT PRIVILEGES
test=# \ddp alpha
         Default access privileges
 Owner | Schema | Type | Access privileges
-------+--------+------+-------------------
(0 rows)

test=# drop user alpha;
DROP ROLE

Conclusion 1 : Drop is working

***********************************************************************************************************************************************************************************
Scenario 2 : create a user alpha then revoke default privileges from himself
test=# create user alpha;
CREATE ROLE
test=#  ALTER DEFAULT PRIVILEGES FOR ROLE alpha REVOKE  ALL ON TABLES FROM
alpha;
ALTER DEFAULT PRIVILEGES
test=# \ddp alpha
         Default access privileges
 Owner | Schema | Type  | Access privileges
-------+--------+-------+-------------------
 alpha |        | table | (none)
(1 row)

test=# drop user alpha;
ERROR:  role "alpha" cannot be dropped because some objects depend on it
DETAIL:  owner of default privileges on new relations belonging to role
alpha

Conclusion 2 : Drop is not working
***********************************************************************************************************************************************************************************
Scenario 3 : create a user alpha and beta then grant default privileges to
both users
test=# create user alpha;
CREATE ROLE
test=# create user beta;
CREATE ROLE
test=#  ALTER DEFAULT PRIVILEGES FOR ROLE alpha GRANT ALL ON TABLES to beta;
ALTER DEFAULT PRIVILEGES
test=# \ddp alpha
          Default access privileges
 Owner | Schema | Type  |  Access privileges
-------+--------+-------+---------------------
 alpha |        | table | beta=arwdDxtm/alpha
(1 row)

test=#  ALTER DEFAULT PRIVILEGES FOR ROLE alpha GRANT ALL ON TABLES to
alpha;
ALTER DEFAULT PRIVILEGES
test=# \ddp alpha
           Default access privileges
 Owner | Schema | Type  |  Access privileges
-------+--------+-------+----------------------
 alpha |        | table | alpha=arwdDxtm/alpha+
       |        |       | beta=arwdDxtm/alpha
(1 row)

test=# drop user alpha;
ERROR:  role "alpha" cannot be dropped because some objects depend on it
DETAIL:  owner of default privileges on new relations belonging to role
alpha

test=#  ALTER DEFAULT PRIVILEGES FOR ROLE alpha REVOKE  ALL ON TABLES FROM
beta;
ALTER DEFAULT PRIVILEGES
test=# \ddp alpha
         Default access privileges
 Owner | Schema | Type | Access privileges
-------+--------+------+-------------------
(0 rows)

test=# drop user alpha;
DROP ROLE

Conclusion 3 : Drop is working whereas DEFAULT PRIVILEGES are still granted
to alpha








view thread (3+ messages)  latest in thread

Message-ID: <19682-21342a50fcf153e5@postgresql.org>
Permalink:  ../19682-21342a50fcf153e5@postgresql.org/
Also on:    postgresql.org/message-id/19682-21342a50fcf153e5@postgresql.org

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, ext.solutec.sperraud@grandlyon.com
  Subject: Re: BUG #19682: Unable to drop a user with default privileges revoked
  In-Reply-To: <19682-21342a50fcf153e5@postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox