BUG #18664: Assert in BeginCopyTo() fails when source DML query rewritten with notifying rule - Mailing list pgsql-bugs

From PG Bug reporting form
Subject BUG #18664: Assert in BeginCopyTo() fails when source DML query rewritten with notifying rule
Date
Msg-id 18664-ffd0ebc2386598df@postgresql.org
Whole thread Raw
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      18664
Logged by:          Alexander Lakhin
Email address:      exclusion@gmail.com
PostgreSQL version: 17.0
Operating system:   Ubuntu 22.04
Description:

The following script:
CREATE TABLE t(i int);
CREATE RULE r AS ON INSERT TO t DO INSTEAD NOTIFY c;
COPY (INSERT INTO t VALUES (1)) TO stdout;

triggers an Assert in BeginCopyTo():
TRAP: failed Assert("query->utilityStmt == NULL"), File: "copyto.c", Line:
495, PID: 1689825
ExceptionalCondition at assert.c:52:13
BeginCopyTo at copyto.c:501:12
DoCopy at copy.c:313:12
standard_ProcessUtility at utility.c:738:8
ProcessUtility at utility.c:523:3
PortalRunUtility at pquery.c:1158:2
PortalRunMulti at pquery.c:1315:5
PortalRun at pquery.c:795:5
...

Reproduced starting from 92e38182d.


pgsql-bugs by date:

Previous
From: Amit Langote
Date:
Subject: Re: BUG #18657: Using JSON_OBJECTAGG with volatile function leads to segfault
Next
From: PG Bug reporting form
Date:
Subject: BUG #18665: Breaking a foreign constraint: the error message may be more detailed