On Mon, Jul 6, 2026 at 4:32 PM Richard Guo <[email protected]> wrote:
>
> On Wed, Jul 1, 2026 at 2:59 PM Tender Wang <[email protected]> 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