Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bMs11-0008T2-8x for pgsql-hackers@arkaria.postgresql.org; Tue, 12 Jul 2016 07:21:59 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bMs0z-0004I4-Iw for pgsql-hackers@arkaria.postgresql.org; Tue, 12 Jul 2016 07:21:57 +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 1bMrzc-0002mv-1Q for pgsql-hackers@postgreSQL.org; Tue, 12 Jul 2016 07:20:32 +0000 Received: from gauss.credativ.com ([93.94.130.89]) by makus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bMrzU-00019K-Hr for pgsql-hackers@postgreSQL.org; Tue, 12 Jul 2016 07:20:30 +0000 Received: from gauss.credativ.com (localhost [127.0.0.1]) by gauss.credativ.com (Postfix) with ESMTP id 77CD01B44AF; Tue, 12 Jul 2016 09:20:20 +0200 (CEST) Received: from ex (ip-109-44-3-172.web.vodafone.de [109.44.3.172]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: ase@gauss.credativ.com) by gauss.credativ.com (Postfix) with ESMTPSA id C76F01B44AB; Tue, 12 Jul 2016 09:20:19 +0200 (CEST) From: Andreas Seltenreich To: Tom Lane Cc: pgsql-hackers@postgreSQL.org Subject: Re: GiST index build versus NaN coordinates In-Reply-To: <28685.1468246504@sss.pgh.pa.us> (Tom Lane's message of "Mon, 11 Jul 2016 10:15:04 -0400") References: <28685.1468246504@sss.pgh.pa.us> User-Agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/24.4 (gnu/linux) Message-ID: <878tx7491q.fsf@credativ.de> Date: Tue, 12 Jul 2016 09:20:17 +0200 MIME-Version: 1.0 Content-Type: text/plain X-Pg-Spam-Score: -1.9 (-) 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 Tom Lane writes: > 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. Sounds like some fuzz testing with nan/infinity is in order. sqlsmith doesn't generate any float literals, but it calls functions to satisfy its need for values of specific types. Adding suitable functions[1] to the regression db, I made the following observations: The infinite loop from the bug report was triggered. Further, two previously unseen errors are logged: ERROR: timestamp cannot be NaN ERROR: getQuadrant: impossible case The first is porbably as boring as it gets, the second one is from the getQuadrant() in spgquadtreeproc.c. Curiously, the getQuadrant()s in geo_spgist.c and rangetypes_spgist.c do not have such a check. I guess the boxes will just end up in an undefined position in the index for these. regards Andreas Footnotes: [1] create function smith_double_inf() returns float as $$select 'infinity'::float$$ language sql immutable; create function smith_double_ninf() returns float as $$select '-infinity'::float$$ language sql immutable; create function smith_double_nan() returns float as $$select 'nan'::float$$ language sql immutable; create function smith_real_nan() returns real as $$select 'nan'::real$$ language sql immutable; create function smith_real_inf() returns real as $$select 'infinity'::real$$ language sql immutable; create function smith_real_ninf() returns real as $$select '-infinity'::real$$ language sql immutable; -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers