From: Michael Paquier <michael@paquier.xyz>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Fix misbehavior of DROP OWNED BY with duplicate polroles entries
Date: Sat, 19 Jun 2021 08:18:18 +0900
Message-ID: <YM0puvBnbBIZxJt2@paquier.xyz> (raw)
In-Reply-To: <E1luMXR-00054E-8H@gemulon.postgresql.org>
References: <E1luMXR-00054E-8H@gemulon.postgresql.org>
On Fri, Jun 18, 2021 at 10:00:33PM +0000, Tom Lane wrote:
> Fix misbehavior of DROP OWNED BY with duplicate polroles entries.
>
> Ordinarily, a pg_policy.polroles array wouldn't list the same role
> more than once; but CREATE POLICY does not prevent that. If we
> perform DROP OWNED BY on a role that is listed more than once,
> RemoveRoleFromObjectPolicy either suffered an assertion failure
> or encountered a tuple-updated-by-self error. Rewrite it to cope
> correctly with duplicate entries, and add a CommandCounterIncrement
> call to prevent the other problem.
>
> Per discussion, there's other cleanup that ought to happen here,
> but this seems like the minimum essential fix.
A nit here.
+ /* If any roles remain, update the policy entry. */
+ if (num_roles > 0)
+ {
/* This is the array for the new tuple */
This indentation is incorrect.
--
Michael
Attachments:
signature.asc (application/pgp-signature, 832B) download
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: michael@paquier.xyz, tgl@sss.pgh.pa.us
Subject: Re: pgsql: Fix misbehavior of DROP OWNED BY with duplicate polroles entries
In-Reply-To: <YM0puvBnbBIZxJt2@paquier.xyz>
References: <E1luMXR-00054E-8H@gemulon.postgresql.org> <YM0puvBnbBIZxJt2@paquier.xyz>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox