Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bMhyC-0002rH-Py for pgsql-hackers@arkaria.postgresql.org; Mon, 11 Jul 2016 20:38:24 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bMhyC-0002Og-By for pgsql-hackers@arkaria.postgresql.org; Mon, 11 Jul 2016 20:38:24 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bMhyA-0002Nk-V9 for pgsql-hackers@postgresql.org; Mon, 11 Jul 2016 20:38:23 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bMhy4-0004ih-0a for pgsql-hackers@postgresql.org; Mon, 11 Jul 2016 20:38:21 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id u6BKcEWN001920; Mon, 11 Jul 2016 16:38:14 -0400 From: Tom Lane To: emre@hasegeli.com cc: PostgreSQL Hackers Subject: Re: GiST index build versus NaN coordinates In-reply-to: References: <28685.1468246504@sss.pgh.pa.us> Comments: In-reply-to Emre Hasegeli message dated "Mon, 11 Jul 2016 22:25:16 +0200" Date: Mon, 11 Jul 2016 16:38:14 -0400 Message-ID: <1919.1468269494@sss.pgh.pa.us> X-Pg-Spam-Score: -3.2 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Emre Hasegeli 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