Re: btree_gist: Fix NaN handling in float4 and float8 opclasses - Mailing list pgsql-hackers

From Ewan Young
Subject Re: btree_gist: Fix NaN handling in float4 and float8 opclasses
Date
Msg-id CAON2xHMrsUkWw6=ZfxA73dp1iBhr1r0aj=C0BwuE8dtE2DqsTQ@mail.gmail.com
Whole thread
In response to Re: btree_gist: Fix NaN handling in float4 and float8 opclasses  (Tender Wang <tndrwang@gmail.com>)
List pgsql-hackers
Thanks Tender -- you're right, this is the same issue as #19501
(Man Zeng, 2026-05-29), which I missed before posting.  Apologies for
the duplicate; let's consolidate on that thread.

On Wed, Jun 17, 2026 at 5:56 PM Tender Wang <tndrwang@gmail.com> wrote:
>
> Ewan Young <kdbase.hack@gmail.com> 于2026年6月17日周三 16:40写道:
> >
> > Hi,
> >
> > A GiST index on a float4/float8 column (via btree_gist) can silently
> > omit rows containing NaN, returning different results from a sequential
> > scan:
> >
> >     CREATE EXTENSION btree_gist;
> >     CREATE TABLE t (a float8);
> >     INSERT INTO t SELECT 1 FROM generate_series(1, 1000);
> >     INSERT INTO t SELECT 'NaN' FROM generate_series(1, 1000);
> >     CREATE INDEX ON t USING gist (a);
> >
> >     SET enable_seqscan = on;
> >     SELECT count(*) FROM t WHERE a = 'NaN';   -- 1000
> >     SET enable_seqscan = off;
> >     SELECT count(*) FROM t WHERE a = 'NaN';   -- 0  (wrong)
> >
>
> It seems the issue you reported is the same as [1].
> Please double-check.
>
> [1] https://www.postgresql.org/message-id/19501-3bff3bbc97f1e7c9%40postgresql.org
>
>
> --
> Thanks,
> Tender Wang



pgsql-hackers by date:

Previous
From: Etsuro Fujita
Date:
Subject: Re: use of SPI by postgresImportForeignStatistics
Next
From: Ilia Evdokimov
Date:
Subject: Re: Show estimated number of groups for IncrementalSort in EXPLAIN