Re: Fix HAVING-to-WHERE pushdown with mismatched operator families
Tender Wang <tndrwang@gmail.com>
From: Tender Wang <tndrwang@gmail.com>
To: Richard Guo <guofenglinux@gmail.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2026-07-01T05:58:48Z
Lists: pgsql-hackers
Richard Guo <guofenglinux@gmail.com> 于2026年6月30日周二 17:22写道: > > On Mon, Jun 29, 2026 at 5:32 PM Tender Wang <tndrwang@gmail.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