From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Fix misbehavior of DROP OWNED BY with duplicate polroles entries |
Date: | 2021-06-18 22:00:33 |
Message-ID: | E1luMXR-00054L-9n@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
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.
Per bug #17062 from Alexander Lakhin. It's been broken all along,
so back-patch to all supported branches.
Discussion: https://postgr.es/m/17062-11f471ae3199ca23@postgresql.org
Branch
------
REL_11_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/ea5ae3ae1ab0793d3d6125ff19b79e4c413a2688
Modified Files
--------------
src/backend/commands/policy.c | 50 +++++++++++++++++--------------
src/test/regress/expected/rowsecurity.out | 9 ++++++
src/test/regress/sql/rowsecurity.sql | 10 +++++++
3 files changed, 46 insertions(+), 23 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2021-06-18 22:50:03 | pgsql: Add test case for obsoleting slot with active walsender |
Previous Message | Tom Lane | 2021-06-18 21:05:29 | pgsql: Improve version reporting in pgbench. |