Re: GiST index build versus NaN coordinates

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andreas Seltenreich <seltenreich(at)gmx(dot)de>
Cc: Emre Hasegeli <emre(at)hasegeli(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: GiST index build versus NaN coordinates
Date: 2016-07-12 20:20:22
Message-ID: 3740.1468354822@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I wrote:
> Andreas Seltenreich <seltenreich(at)gmx(dot)de> writes:
>> 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.

> Yeah, the first one is presumably from float8_timestamptz() intentionally
> rejecting a NaN, which seems fine.

>> 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.

> Right, we probably want them all to apply some consistent ordering ---
> doesn't matter so much what it is, but float8's rule is as good as any.

I looked into these a bit more closely. I think rangetypes_spgist.c is
fine as-is: it's relying on the range component type to provide a total
ordering of its values, and if the component type fails to do that, it's
the fault of the component type not the range code.

spgquadtreeproc.c and geo_spgist.c both have got NaN issues, but the code
in both of them is rather tightly tied to the fuzzy-geometric-comparisons
logic that Emre has been messing with. I think we ought to put "what
to do with NaNs?" into that same can of worms, rather than try to resolve
it separately. (Yeah, I know, I just made Emre's job even harder.)

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Fabrízio de Royes Mello 2016-07-12 20:42:21 Re: [COMMITTERS] Logical decoding
Previous Message Stephen Frost 2016-07-12 20:18:19 Re: dumping database privileges broken in 9.6