Re: BUG #14924: Subquery in VALUES inside recursive CTE
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: christianmduta@gmail.com
Cc: pgsql-bugs@postgresql.org
Date: 2017-11-24T17:06:26Z
Lists: pgsql-bugs
christianmduta@gmail.com writes:
> When working with recursive CTEs, I had the following happen:
Thanks for the report! Seems not to be specific to CTEs:
regression=# SELECT val.x
FROM generate_series(1,10) AS s(i),
LATERAL (
VALUES
((SELECT s.i + 1)),
(s.i + 1)
) AS val(x)
WHERE s.i < 10;
ERROR: SubPlan found with no parent plan
However, simplifying further, this works:
regression=# SELECT val.x
FROM generate_series(1,10) AS s(i),
LATERAL (
VALUES
((SELECT 1 + 1)),
(s.i + 1)
) AS val(x)
WHERE s.i < 10;
so it looks like it's the LATERAL reference inside the sub-select
that is needed to trigger the bug.
Same results back to 9.3 :-(
regards, tom lane
Commits
-
Repair failure with SubPlans in multi-row VALUES lists.
- d538f65684a5 9.3.21 landed
- ae6ed0784176 9.5.11 landed
- 9b63c13f0a21 11.0 landed
- 5dc7faa91e19 10.2 landed
- 497e79b96135 9.6.7 landed
- 2e105cf6db21 9.4.16 landed
-
Arrange for ValuesScan to keep per-sublist expression eval state in a
- 0dfb595d7a5e 8.2.0 cited