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

Started by Jim Jones3 days ago1 messageshackers

Thread notes

1 note#bug
hackorum-bot#bug
hackorum-bot
2 days ago

@global #bug

#bug
Jump to latest
#1Jim Jones
jim.jones@uni-muenster.de

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

Attachments:

t260208_1
v1-0001-Fix-DROP-OWNED-of-both-the-owner-and-a-grantee-of.patchtext/x-patch; charset=UTF-8; name=v1-0001-Fix-DROP-OWNED-of-both-the-owner-and-a-grantee-of.patchDownload+31-1