agora inbox for pgsql-bugs@postgresql.org  
help / color / mirror / Atom feed
From: Andrei Lepikhov <lepihov@gmail.com>
To: Andrey Rachitskiy <pl0h0yp1@gmail.com>
To: 303677365@qq.com
To: pgsql-bugs@lists.postgresql.org
Cc: Tender Wang <tndrwang@gmail.com>
Subject: Re: BUG #19649: Qual pushdown into GROUP BY subqueries ignores non-equivalence-preserving references to grouping col
Date: Fri, 4 Sep 2026 17:12:20 +0200
Message-ID: <60c6b1f7-f435-4ca7-992a-482417af5130@gmail.com> (raw)
In-Reply-To: <CAB8bMiss5S2SZonboQfbTMJsNCd+k_J8AbeS-vXheVUrR_TUhQ@mail.gmail.com>
References: <19649-2cabf1440793cc71@postgresql.org>
	<CAB8bMiss5S2SZonboQfbTMJsNCd+k_J8AbeS-vXheVUrR_TUhQ@mail.gmail.com>

On 03/09/2026 23:17, Andrey Rachitskiy wrote:
> This blocks wrapper-based finer equivalence at pushdown boundaries while
> preserving existing behavior for truly direct operands.
I don't like this fix. It causes regressions where we haven't had it before.
Let's see:

CREATE TABLE r(i int, s text, ts timestamptz);
EXPLAIN (COSTS OFF)
SELECT * FROM (SELECT i, count(*) c FROM r GROUP BY i) s WHERE i::text = '5';

Before:

 GroupAggregate
   Group Key: r.i
   ->  Sort
         Sort Key: r.i
         ->  Seq Scan on r
               Filter: ((i)::text = '5'::text)

With your fix:

 HashAggregate
   Group Key: r.i
   Filter: ((r.i)::text = '5'::text)
   ->  Seq Scan on r

I think, filter should be pushed down to the scan.

-- 
regards, Andrei Lepikhov,
pgEdge





view thread (9+ messages)  latest in thread

Message-ID: <60c6b1f7-f435-4ca7-992a-482417af5130@gmail.com>
Permalink:  ../60c6b1f7-f435-4ca7-992a-482417af5130@gmail.com/
Also on:    postgresql.org/message-id/60c6b1f7-f435-4ca7-992a-482417af5130@gmail.com

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: lepihov@gmail.com, pl0h0yp1@gmail.com, 303677365@qq.com, pgsql-bugs@lists.postgresql.org, tndrwang@gmail.com
  Subject: Re: BUG #19649: Qual pushdown into GROUP BY subqueries ignores non-equivalence-preserving references to grouping col
  In-Reply-To: <60c6b1f7-f435-4ca7-992a-482417af5130@gmail.com>

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

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox