| From: | Fujii Masao <masao(dot)fujii(at)gmail(dot)com> |
|---|---|
| To: | Richard Guo <guofenglinux(at)gmail(dot)com> |
| Cc: | Tender Wang <tndrwang(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: Fix HAVING-to-WHERE pushdown with mismatched operator families |
| Date: | 2026-07-06 22:43:50 |
| Message-ID: | CAHGQGwGnPNX=nK+nXL0ihh+8WObQnFWjnPi5uvxBFvbtqN9WmQ@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Mon, Jul 6, 2026 at 4:32 PM Richard Guo <guofenglinux(at)gmail(dot)com> wrote:
>
> On Wed, Jul 1, 2026 at 2:59 PM Tender Wang <tndrwang(at)gmail(dot)com> wrote:
> > I look through the v3 patch. I didn't find an obvious issue. +1
>
> Thanks all for the reviews. I've committed this patch and backported
> it to v18.
In HEAD, I found what looks like another case of the same issue. Is the
cause essentially the same as the one fixed by your commit?
--------------------------
CREATE TEMP TABLE t (id int, num numeric);
INSERT INTO t VALUES (1, numeric '1.0'), (2, numeric '1.00');
SELECT * FROM (
SELECT DISTINCT ON (num) id, num FROM t ORDER BY num, id
) s WHERE scale(num) = 2;
--------------------------
This query should return no rows. The subquery selects the first row
(id = 1, num = 1.0), and the outer WHERE clause should then filter
it out because scale(1.0) = 1, not 2.
But, in HEAD it returns:
id | num
----+------
2 | 1.00
(1 row)
Regards,
--
Fujii Masao
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tristan Partin | 2026-07-06 22:52:02 | Re: Add pg_stat_kind_info system view |
| Previous Message | Andrey Rachitskiy | 2026-07-06 22:41:57 | [PATCH] Limit PL/Perl scalar copies to work_mem |