Re: BUG #14924: Subquery in VALUES inside recursive CTE

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: christianmduta(at)gmail(dot)com
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #14924: Subquery in VALUES inside recursive CTE
Date: 2017-11-24 17:06:26
Message-ID: 29657.1511543186@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

christianmduta(at)gmail(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Francisco Olarte 2017-11-24 18:03:59 Re: BUG #14923: Java driver - PreparedStatement setNull in SELECT query
Previous Message Pavel Golub 2017-11-24 15:13:19 Re: Windows 10 Support Version