Re: GiST index build versus NaN coordinates

From: Emre Hasegeli <emre(at)hasegeli(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: GiST index build versus NaN coordinates
Date: 2016-07-11 20:25:16
Message-ID: CAE2gYzyCerqkP1rWEfOK2iNhr+TATFFb7-Yifut2_4Pzhdwq_g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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?

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2016-07-11 20:38:14 Re: GiST index build versus NaN coordinates
Previous Message Tom Lane 2016-07-11 20:09:27 Re: IMPORT FOREIGN SCHEMA can't be run in in pl/pgsql due to INTO