Re: Fix HAVING-to-WHERE pushdown with mismatched operator families

From: Tender Wang <tndrwang(at)gmail(dot)com>
To: Richard Guo <guofenglinux(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Fix HAVING-to-WHERE pushdown with mismatched operator families
Date: 2026-07-01 05:58:48
Message-ID: CAHewXNkk=uc-6rgOd=Z4R-Q9OqM0jcZ2N1K+DaqvTZ3dxhLXOA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Richard Guo <guofenglinux(at)gmail(dot)com> 于2026年6月30日周二 17:22写道:
>
> On Mon, Jun 29, 2026 at 5:32 PM Tender Wang <tndrwang(at)gmail(dot)com> wrote:
> > If we find a function wrapped on the Var, we give up the qual pushed down.
> > We still have the optimization opportunity that if the OpExpr contains
> > a bare Var on one side.
> This would make us fail to push some clauses that are in fact safe but
> that we cannot prove safe. But I think those cases are very narrow:
> they require a nondeterministic grouping key with a function-wrapped
> qual on it, and a plain direct comparison such as x = 'foo' COLLATE ci
> still pushes, so the optimization loss is small and limited to
> nondeterministic collations.
>
> Thoughts?

I look through the v3 patch. I didn't find an obvious issue. +1

> IIUC, this has nothing to do with what we are trying to fix here. For
> this query, the qual cannot be pushed down either even without this
> patch. So I don't feel motivated to touch it in this patch.

Yeah, the previous query I reported has nothing to do with the topic
we're talking about here.
Ignore the noise.

--
Thanks,
Tender Wang

In response to

Browse pgsql-hackers by date

  From Date Subject
Previous Message Ashutosh Bapat 2026-07-01 05:33:51 Re: GetBufferDescriptor() being called for local buffers from MarkBufferDirtyHint()