Inconsistent results from seqscan and gist indexscan

From: Richard Guo <guofenglinux(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Inconsistent results from seqscan and gist indexscan
Date: 2021-11-26 06:09:50
Message-ID: CAMbWs4-C9K-8V=cAY7q0ciZmJKBMiUnp_xBGzxgKpEWPKd0bng@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Here is how it can be reproduced.

create table point_tbl (f1 point);

insert into point_tbl(f1) values ('(5.1, 34.5)');
insert into point_tbl(f1) values (' ( Nan , NaN ) ');
analyze;

create index gpointind on point_tbl using gist (f1);

set enable_seqscan to on;
set enable_indexscan to off;
# select * from point_tbl where f1 <@ polygon
'(0,0),(0,100),(100,100),(100,0),(0,0)';
f1
------------
(5.1,34.5)
(NaN,NaN)
(2 rows)

set enable_seqscan to off;
set enable_indexscan to on;
# select * from point_tbl where f1 <@ polygon
'(0,0),(0,100),(100,100),(100,0),(0,0)';
f1
------------
(5.1,34.5)
(1 row)

Seems point_inside() does not handle NaN properly.

BTW, I'm using 15devel. But this issue can be seen in at least 12
version also.

Thanks
Richard

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2021-11-26 06:20:08 Re: pg_waldump stucks with options --follow or -f and --stats or -z
Previous Message Michael Paquier 2021-11-26 05:57:14 Re: Postgres restart in the middle of exclusive backup and the presence of backup_label file