| From: | Andrey Rachitskiy <pl0h0yp1(at)gmail(dot)com> |
|---|---|
| To: | Andrei Lepikhov <lepihov(at)gmail(dot)com> |
| Cc: | 303677365(at)qq(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org, Tender Wang <tndrwang(at)gmail(dot)com> |
| Subject: | Re: BUG #19649: Qual pushdown into GROUP BY subqueries ignores non-equivalence-preserving references to grouping col |
| Date: | 2026-09-04 16:10:50 |
| Message-ID: | CAB8bMivStAVVSPonHGeP0-Uxb5bd2mgLNyBunYxHG1s+UxnKOQ@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
пт, 4 сент. 2026 г. в 20:12, Andrei Lepikhov <lepihov(at)gmail(dot)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
>
Dear Andrei,
Thanks for the review.
v2 with a correction in the attachment.
I also removed the duplicate logic.
--
Regards,
Rachitskiy Andrey
| Attachment | Content-Type | Size |
|---|---|---|
| v2-0001-Fix-qual-pushdown-for-wrapped-grouping-comparisons.patch | text/x-patch | 14.6 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2026-09-04 17:27:19 | Re: BUG #19644: byteaout, float8out and float4out are marked IMMUTABLE but depend on GUCs |
| Previous Message | Fujii Masao | 2026-09-04 15:54:17 | Re: BUG #19644: byteaout, float8out and float4out are marked IMMUTABLE but depend on GUCs |