pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: sully@msully.net
Subject: BUG #17479: "plan should not reference subplan's variable" when calling `grouping` on result of subquery
Date: Tue, 10 May 2022 01:02:35 +0000
Message-ID: <17479-6260deceaf0ad304@postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      17479
Logged by:          Michael J. Sullivan
Email address:      sully@msully.net
PostgreSQL version: 14.2
Operating system:   Linux
Description:        

The following query produces "plan should not reference subplan's
variable"

create table Card (id uuid);

SELECT
    -- This line causes "variable not found in subplan target list"
    -- grouping(res.cnt)
    -- This line causes "plan should not reference subplan's variable"
   (SELECT grouping(res.cnt))
FROM Card
CROSS JOIN LATERAL
(SELECT
    (SELECT Card.id) AS cnt
) AS res
GROUP BY
    res.cnt

As the comment says, a slight change instead errors with "variable not found
in subplan target list".



view thread (6+ messages)  latest in thread

Message-ID: <17479-6260deceaf0ad304@postgresql.org>
Permalink:  ../17479-6260deceaf0ad304@postgresql.org/
Also on:    postgresql.org/message-id/17479-6260deceaf0ad304@postgresql.org

 · 

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: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, sully@msully.net
  Subject: Re: BUG #17479: "plan should not reference subplan's variable" when calling `grouping` on result of subquery
  In-Reply-To: <17479-6260deceaf0ad304@postgresql.org>

* 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