From: Tom Lane <tgl@sss.pgh.pa.us>
To: emre@hasegeli.com
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Subject: Re: GiST index build versus NaN coordinates
Date: Mon, 11 Jul 2016 16:38:14 -0400
Message-ID: <1919.1468269494@sss.pgh.pa.us> (raw)
In-Reply-To: <CAE2gYzyCerqkP1rWEfOK2iNhr+TATFFb7-Yifut2_4Pzhdwq_g@mail.gmail.com>
References: <28685.1468246504@sss.pgh.pa.us>
<CAE2gYzyCerqkP1rWEfOK2iNhr+TATFFb7-Yifut2_4Pzhdwq_g@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
Emre Hasegeli <emre@hasegeli.com> writes:
>> 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:
Yes, and that is itself inconsistent with the behavior of the primitive
float8 datatype:
regression=# select '4'::float8 < 'NaN'::float8;
?column?
----------
t
(1 row)
I'm inclined to think that we ought to try to make NaNs in geometric types
work like float8 thinks they work, ie they compare higher than non-NaNs.
Yeah, it would make an IEEE-spec purist blanch, but there is no room for
unordered values in a datatype that you would like to be indexable, or
groupable.
> Is it reasonable to disallow NaN coordinates on the next major
> release. Are there any reason to deal with them?
I don't see how we can do that; what would you do about tables already
containing NaNs? Even without that consideration, assuming that there's
no way a NaN could creep in seems a pretty fragile assumption, considering
that operations like Infinity/Infinity will produce one.
regards, tom lane
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-hackers@postgresql.org
Cc: tgl@sss.pgh.pa.us, emre@hasegeli.com
Subject: Re: GiST index build versus NaN coordinates
In-Reply-To: <1919.1468269494@sss.pgh.pa.us>
References: <28685.1468246504@sss.pgh.pa.us> <CAE2gYzyCerqkP1rWEfOK2iNhr+TATFFb7-Yifut2_4Pzhdwq_g@mail.gmail.com> <1919.1468269494@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox