pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #18608: Assert in check_agglevels_and_constraints() fails on creating a rule with aggr(NEW) in subselect
2+ messages / 2 participants
[nested] [flat]

* BUG #18608: Assert in check_agglevels_and_constraints() fails on creating a rule with aggr(NEW) in subselect
@ 2024-09-10 18:00  PG Bug reporting form <noreply@postgresql.org>
  0 siblings, 1 reply; 2+ messages in thread

From: PG Bug reporting form @ 2024-09-10 18:00 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org; +Cc: exclusion@gmail.com

The following bug has been logged on the website:

Bug reference:      18608
Logged by:          Alexander Lakhin
Email address:      exclusion@gmail.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.



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: BUG #18608: Assert in check_agglevels_and_constraints() fails on creating a rule with aggr(NEW) in subselect
@ 2024-09-10 19:06  Tom Lane <tgl@sss.pgh.pa.us>
  parent: PG Bug reporting form <noreply@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2024-09-10 19:06 UTC (permalink / raw)
  To: exclusion@gmail.com; +Cc: pgsql-bugs@lists.postgresql.org

PG Bug reporting form <noreply@postgresql.org> writes:
> [ NEW reference confuses check_agglevels_and_constraints ]

> 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

Interesting.  I'm inclined to just remove the Assert, since it's
evidently wrong and the ensuing error seems sufficiently on-point.

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2024-09-10 19:06 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-09-10 18:00 BUG #18608: Assert in check_agglevels_and_constraints() fails on creating a rule with aggr(NEW) in subselect PG Bug reporting form <noreply@postgresql.org>
2024-09-10 19:06 ` Tom Lane <tgl@sss.pgh.pa.us>

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