Обсуждение: Inconsistent results from seqscan and gist indexscan

Поиск
Список
Период
Сортировка

Inconsistent results from seqscan and gist indexscan

От
Richard Guo
Дата:
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

Re: Inconsistent results from seqscan and gist indexscan

От
Julien Rouhaud
Дата:
Hi,

On Fri, Nov 26, 2021 at 2:10 PM Richard Guo <guofenglinux@gmail.com> wrote:
>
> Seems point_inside() does not handle NaN properly.

This is unfortunately a known issue, which was reported twice ([1] and
[2]) already.  There's a patch proposed for it:
https://commitfest.postgresql.org/32/2710/ (adding Horiguchi-san in
Cc).

[1]: https://www.postgresql.org/message-id/flat/CAGf+fX70rWFOk5cd00uMfa__0yP+vtQg5ck7c2Onb-Yczp0URA@mail.gmail.com
[2]: https://www.postgresql.org/message-id/20210330095751.x5hnqbqcxilzwjlm%40nol



Re: Inconsistent results from seqscan and gist indexscan

От
Richard Guo
Дата:

On Fri, Nov 26, 2021 at 5:23 PM Julien Rouhaud <rjuju123@gmail.com> wrote:
Hi,

On Fri, Nov 26, 2021 at 2:10 PM Richard Guo <guofenglinux@gmail.com> wrote:
>
> Seems point_inside() does not handle NaN properly.

This is unfortunately a known issue, which was reported twice ([1] and
[2]) already.  There's a patch proposed for it:
https://commitfest.postgresql.org/32/2710/ (adding Horiguchi-san in
Cc).

Ah, I missed the previous threads. Good to know there is a patch fixing
it.

Thanks
Richard 

Re: Inconsistent results from seqscan and gist indexscan

От
Tom Lane
Дата:
Richard Guo <guofenglinux@gmail.com> writes:
> On Fri, Nov 26, 2021 at 5:23 PM Julien Rouhaud <rjuju123@gmail.com> wrote:
>> On Fri, Nov 26, 2021 at 2:10 PM Richard Guo <guofenglinux@gmail.com>
>> wrote:
>>> Seems point_inside() does not handle NaN properly.

>> This is unfortunately a known issue, which was reported twice ([1] and
>> [2]) already.  There's a patch proposed for it:
>> https://commitfest.postgresql.org/32/2710/ (adding Horiguchi-san in
>> Cc).

> Ah, I missed the previous threads. Good to know there is a patch fixing
> it.

Note that that patch seems pretty well stalled; if you'd like to
see it move forward, please pitch in and help review.

(Maybe we should scale back the patch's ambitions, and just try
to get the seqscan/indexscan inconsistency fixed.)

            regards, tom lane