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

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: exclusion(at)gmail(dot)com
Subject: BUG #17062: Assert failed in RemoveRoleFromObjectPolicy() on DROP OWNED policy applied to duplicate role
Date: 2021-06-17 20:33:46
Message-ID: 17062-11f471ae3199ca23@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 17062
Logged by: Alexander Lakhin
Email address: exclusion(at)gmail(dot)com
PostgreSQL version: 14beta1
Operating system: Ubuntu 20.04
Description:

When executing the following query:
CREATE USER role1;
CREATE TABLE t1(id int);
CREATE POLICY p1 ON t1 TO role1,role1 USING (true);
DROP OWNED BY role1;

The server halts with the failed assertion:
Core was generated by `postgres: law regression [local] DROP OWNED
'.
Program terminated with signal SIGABRT, Aborted.
#0 __GI_raise (sig=sig(at)entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0 __GI_raise (sig=sig(at)entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1 0x00007f09b9f31859 in __GI_abort () at abort.c:79
#2 0x0000560bfa59234a in ExceptionalCondition
(conditionName=conditionName(at)entry=0x560bfa6caf96 "j == num_roles",
errorType=errorType(at)entry=0x560bfa5f100b "FailedAssertion",
fileName=0x7ffdc84f5020 "+#Y\372\vV",
fileName(at)entry=0x560bfa6caf21 "policy.c",
lineNumber=lineNumber(at)entry=593) at assert.c:69
#3 0x0000560bfa23c83f in RemoveRoleFromObjectPolicy
(roleid=roleid(at)entry=16385, classid=<optimized out>,
policy_id=16389) at policy.c:593
#4 0x0000560bfa1a43ec in shdepDropOwned
(roleids=roleids(at)entry=0x560bfb3d9878, behavior=DROP_RESTRICT)
at pg_shdepend.c:1420
#5 0x0000560bfa2849cf in DropOwnedObjects (stmt=stmt(at)entry=0x560bfb3b8138)
at user.c:1390
#6 0x0000560bfa45e591 in ProcessUtilitySlow
(pstate=pstate(at)entry=0x560bfb3d9760, pstmt=pstmt(at)entry=0x560bfb3b8448,
queryString=queryString(at)entry=0x560bfb3b7690 "DROP OWNED BY role1;",
context=context(at)entry=PROCESS_UTILITY_TOPLEVEL, params=params(at)entry=0x0,
queryEnv=queryEnv(at)entry=0x0,
dest=0x560bfb3b8518, qc=0x7ffdc84f5bb0) at utility.c:1761
#7 0x0000560bfa45d2f0 in standard_ProcessUtility (pstmt=0x560bfb3b8448,
queryString=0x560bfb3b7690 "DROP OWNED BY role1;",
context=PROCESS_UTILITY_TOPLEVEL, params=0x0, queryEnv=0x0,
dest=0x560bfb3b8518, qc=0x7ffdc84f5bb0) at utility.c:1034
#8 0x0000560bfa45d3cf in ProcessUtility (pstmt=pstmt(at)entry=0x560bfb3b8448,
queryString=<optimized out>,
context=context(at)entry=PROCESS_UTILITY_TOPLEVEL, params=<optimized out>,
queryEnv=<optimized out>,
dest=dest(at)entry=0x560bfb3b8518, qc=0x7ffdc84f5bb0) at utility.c:525
#9 0x0000560bfa45a91c in PortalRunUtility
(portal=portal(at)entry=0x560bfb425f70, pstmt=pstmt(at)entry=0x560bfb3b8448,
isTopLevel=isTopLevel(at)entry=true,
setHoldSnapshot=setHoldSnapshot(at)entry=false, dest=dest(at)entry=0x560bfb3b8518,

qc=qc(at)entry=0x7ffdc84f5bb0) at pquery.c:1147
#10 0x0000560bfa45ac1b in PortalRunMulti
(portal=portal(at)entry=0x560bfb425f70, isTopLevel=isTopLevel(at)entry=true,
setHoldSnapshot=setHoldSnapshot(at)entry=false,
dest=dest(at)entry=0x560bfb3b8518, altdest=altdest(at)entry=0x560bfb3b8518,
qc=qc(at)entry=0x7ffdc84f5bb0) at pquery.c:1303
#11 0x0000560bfa45b04f in PortalRun (portal=portal(at)entry=0x560bfb425f70,
count=count(at)entry=9223372036854775807,
isTopLevel=isTopLevel(at)entry=true, run_once=run_once(at)entry=true,
dest=dest(at)entry=0x560bfb3b8518,
altdest=altdest(at)entry=0x560bfb3b8518, qc=0x7ffdc84f5bb0) at
pquery.c:786
#12 0x0000560bfa4572a5 in exec_simple_query
(query_string=query_string(at)entry=0x560bfb3b7690 "DROP OWNED BY role1;")
at postgres.c:1214
#13 0x0000560bfa459277 in PostgresMain (argc=argc(at)entry=1,
argv=argv(at)entry=0x7ffdc84f5da0, dbname=<optimized out>,
username=<optimized out>) at postgres.c:4486
#14 0x0000560bfa3b41b4 in BackendRun (port=port(at)entry=0x560bfb3daae0) at
postmaster.c:4507
#15 0x0000560bfa3b73c9 in BackendStartup (port=port(at)entry=0x560bfb3daae0) at
postmaster.c:4229
#16 0x0000560bfa3b7610 in ServerLoop () at postmaster.c:1745
#17 0x0000560bfa3b8b5d in PostmasterMain (argc=3, argv=<optimized out>) at
postmaster.c:1417
#18 0x0000560bfa2f97a4 in main (argc=3, argv=0x560bfb3b1950) at main.c:209

Without asserts it emits: ERROR: tuple already updated by self

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2021-06-17 21:15:53 Re: BUG #17062: Assert failed in RemoveRoleFromObjectPolicy() on DROP OWNED policy applied to duplicate role
Previous Message Tom Lane 2021-06-17 19:49:47 Re: BUG #16792: silent corruption of GIN index resulting in SELECTs returning non-matching rows