pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Guo <rguo@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Remove the RTE_GROUP RTE if we drop the groupClause
Date: Fri, 25 Oct 2024 00:53:21 +0000
Message-ID: <E1t48Zu-002Iuz-3K@gemulon.postgresql.org> (raw)

Remove the RTE_GROUP RTE if we drop the groupClause

For an EXISTS subquery, the only thing that matters is whether it
returns zero or more than zero rows.  Therefore, we remove certain SQL
features that won't affect that, among them the GROUP BY clauses.

After we drop the groupClause, we'd better remove the RTE_GROUP RTE
and clear the hasGroupRTE flag, as they depend on the groupClause.
Failing to do so could result in a bogus RTE_GROUP entry in the parent
query, leading to an assertion failure on the hasGroupRTE flag.

Reported-by: David Rowley
Author: Richard Guo
Discussion: https://postgr.es/m/CAApHDvp2_yht8uPLyWO-kVGWZhYvx5zjGfSrg4fBQ9fsC13V0g@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/ffe12d1d22e73d7bcda1f0ee9af33d04fab199b2

Modified Files
--------------
src/backend/optimizer/plan/subselect.c | 24 ++++++++++++++++++++++++
src/test/regress/expected/join.out     | 15 +++++++++++++++
src/test/regress/sql/join.sql          |  8 ++++++++
3 files changed, 47 insertions(+)



Message-ID: <E1t48Zu-002Iuz-3K@gemulon.postgresql.org>
Permalink:  ../E1t48Zu-002Iuz-3K@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1t48Zu-002Iuz-3K@gemulon.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-committers@postgresql.org
  Cc: rguo@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Remove the RTE_GROUP RTE if we drop the groupClause
  In-Reply-To: <E1t48Zu-002Iuz-3K@gemulon.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