Re: BUG #17062: Assert failed in RemoveRoleFromObjectPolicy() on DROP OWNED policy applied to duplicate role

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Stephen Frost <sfrost@snowman.net>, Alvaro Herrera <alvherre@alvh.no-ip.org>, exclusion@gmail.com, pgsql-bugs@lists.postgresql.org
Date: 2021-06-23T00:20:31Z
Lists: pgsql-bugs
On Tue, Jun 22, 2021 at 11:10:42AM -0400, Tom Lane wrote:
> I hadn't intended to mess with that, since the main point of this
> patch was just to get rid of unnecessary code.  It could be done as a
> follow-on micro-optimization, if you like.  You'd need to be sure
> that the new coding gets rid of duplicate pg_shdepend entries if there
> are any.

Okay.  There is no urgency in that.  You mentioned it, so I was just
wondering about it.

> Just that if you wanted to add some new roles to the same policy,
> you wouldn't have to remember the rest of the policy's details.

At the same time, nobody has complained about the current behavior
either, and what HEAD does now is the same behavior as one would have
for any objects using SHARED_DEPENDENCY_OWNER which is what DROP OWNED
BY ensures.  So the existing forced deletion seems better kept as-is.
--
Michael

Commits

  1. Remove unnecessary failure cases in RemoveRoleFromObjectPolicy().

  2. Fix misbehavior of DROP OWNED BY with duplicate polroles entries.