DROP OWNED fails when the owner and a grantee of a default ACL are listed together

From: Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: DROP OWNED fails when the owner and a grantee of a default ACL are listed together
Date: 2026-12-03 08:26:53
Message-ID: 5c214302-2b26-40e3-aa33-a653fded0dbb@uni-muenster.de
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi

DROP OWNED fails when one listed role owns a default ACL and another
listed role is its grantee, and the owner comes first in the list ..

== master =

psql (20devel)
Type "help" for help.

postgres=# create role a;
CREATE ROLE
postgres=# create role b;
CREATE ROLE
postgres=# alter default privileges for role a grant select on tables to b;
ALTER DEFAULT PRIVILEGES
postgres=# drop owned by a, b;
ERROR: could not find tuple for default ACL 16391

... the inverted order works though:

postgres=# drop owned by b, a;
DROP OWNED

I could reproduce this on PG15. The attached patch remembers the default
ACLs that shdepDropOwned() has scheduled for deletion and skips ACL
entries of those.

== patch ==

psql (20devel)
Type "help" for help.

postgres=# create role a;
CREATE ROLE
postgres=# create role b;
CREATE ROLE
postgres=# alter default privileges for role a grant select on tables to b;
ALTER DEFAULT PRIVILEGES
postgres=# drop owned by a, b;
DROP OWNED

Thoughts?

Best, Jim

Attachment Content-Type Size
v1-0001-Fix-DROP-OWNED-of-both-the-owner-and-a-grantee-of.patch text/x-patch 4.0 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Ontowhee 2026-12-03 08:37:47 Re: [PATCH] Share WAL summary filtering logic
Previous Message shveta malik 2026-12-03 08:11:59 Re: ALTER DEFAULT PRIVILEGES IN SCHEMA pg_conflict silently has no effect