Re: GiST index build versus NaN coordinates - Mailing list pgsql-hackers

From Emre Hasegeli
Subject Re: GiST index build versus NaN coordinates
Date
Msg-id CAE2gYzyCerqkP1rWEfOK2iNhr+TATFFb7-Yifut2_4Pzhdwq_g@mail.gmail.com
Whole thread Raw
In response to GiST index build versus NaN coordinates  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: GiST index build versus NaN coordinates  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
> I think that probably the most reasonable answer is to replace all the
> raw "double" comparisons in this code with float8_cmp_internal() or
> something that's the moral equivalent of that.  Does anyone want to
> propose something else?

We can probably get away by changing the comparison on the GiST code.
It is not likely to cause inconsistent results.  Comparisons with NaN
coordinates don't return true to anything, anyway:

# select '(3,4),(nan,5)'::box = '(3,4),(nan,5)'::box;?column?
----------f
(1 row)

# select '(3,4),(nan,5)'::box < '(3,4),(nan,5)'::box;?column?
----------f
(1 row)

# select '(3,4),(nan,5)'::box > '(3,4),(nan,5)'::box;?column?
----------f
(1 row)

> More generally, this example makes me fearful that NaN coordinates in
> geometric values are likely to cause all sorts of issues.  It's too late
> to disallow them, probably, but I wonder how can we identify other bugs
> of this ilk.

Is it reasonable to disallow NaN coordinates on the next major
release.  Are there any reason to deal with them?



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: IMPORT FOREIGN SCHEMA can't be run in in pl/pgsql due to INTO
Next
From: Tom Lane
Date:
Subject: Re: GiST index build versus NaN coordinates