| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | "Kamil Monicz" <kamil(at)monicz(dot)dev> |
| Cc: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
| Subject: | Re: BUG #19106: Potential regression with CTE materialization planning in Postgres 18 |
| Date: | 2025-11-10 17:09:20 |
| Message-ID: | 1886977.1762794560@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
"Kamil Monicz" <kamil(at)monicz(dot)dev> writes:
> It's my first time here (and realistically on a proper mailing list), so please excuse me. Here's the small, self-contained reproduction:
Thanks. After a bit of fooling around I was able to convert this
to something without any PostGIS dependency:
EXPLAIN
SELECT *
FROM (
SELECT ARRAY[1, 2] AS arr
) r
CROSS JOIN LATERAL (
WITH a AS (
SELECT id FROM unnest(r.arr) AS id
),
b AS (
SELECT max((SELECT sum(id) FROM a)) AS agg
)
SELECT
(SELECT agg FROM b)
) s;
This worked up until commit b0cc0a71e, and since then it hits an
assertion failure in check_agglevels_and_constraints(); or if you
don't have asserts enabled then the planner gets confused, because
the max() aggregate function is given the wrong agglevelsup.
I need to think through what is the correct behavior for cross-CTE
references like these. Sadly, this is too late for this week's
releases ...
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2025-11-10 17:35:07 | Re: BUG #19108: Stack overflow duting query parse |
| Previous Message | zengman | 2025-11-10 16:37:33 | Re: BUG #19107: The hold cursor is unexpectedly released during rollback |