pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: christianmduta@gmail.com
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #14924: Subquery in VALUES inside recursive CTE
Date: Fri, 24 Nov 2017 12:06:26 -0500
Message-ID: <29657.1511543186@sss.pgh.pa.us> (raw)
In-Reply-To: <20171124120836.1463.5310@wrigleys.postgresql.org>
References: <20171124120836.1463.5310@wrigleys.postgresql.org>

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




view thread (3+ messages)  latest in thread

Message-ID: <29657.1511543186@sss.pgh.pa.us>
Permalink:  ../29657.1511543186@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/29657.1511543186@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, christianmduta@gmail.com
  Subject: Re: BUG #14924: Subquery in VALUES inside recursive CTE
  In-Reply-To: <29657.1511543186@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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