BUG #18608: Assert in check_agglevels_and_constraints() fails on creating a rule with aggr(NEW) in subselect

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 #18608: Assert in check_agglevels_and_constraints() fails on creating a rule with aggr(NEW) in subselect
Date: 2024-09-10 18:00:01
Message-ID: 18608-48de0717508ee429@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: 18608
Logged by: Alexander Lakhin
Email address: exclusion(at)gmail(dot)com
PostgreSQL version: 17rc1
Operating system: Ubuntu 22.04
Description:

The following script:
CREATE TABLE t (a int);
CREATE VIEW v AS SELECT 1;

CREATE RULE v_ins AS ON INSERT TO v
DO INSTEAD INSERT INTO t
SELECT * FROM (SELECT count(NEW) FROM t);

triggers an assertion failure:
TRAP: failed Assert("pstate->p_lateral_active"), File: "parse_agg.c", Line:
385, PID: 2785906

Without asserts enabled, it fails with:
ERROR: aggregate functions are not allowed in FROM clause of their own
query level

Reproduced on REL_9_3_STABLE .. master.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2024-09-10 19:06:20 Re: BUG #18608: Assert in check_agglevels_and_constraints() fails on creating a rule with aggr(NEW) in subselect
Previous Message Andrew Dunstan 2024-09-10 13:47:09 Re: pl/perl extension fails on Windows