From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Alexander Korotkov <aekorotkov(at)gmail(dot)com> |
Cc: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Fix picksplit with nan values |
Date: | 2013-09-06 21:47:11 |
Message-ID: | 6864.1378504031@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Alexander Korotkov <aekorotkov(at)gmail(dot)com> writes:
> PostGIS spotted that picksplit algorithm freezes in infinite loop when
> dealing with nan values. I discovered same bug is present in core
> opclasses. Attached patch fixes this issue interpreting nan as value
> greater than infinity like btree comparison function does.
Hm. Good point, but it seems like some of these hunks are only taking
care of a subset of the possible combinations of input NaNs. If you're
certain the other combinations are impossible, there should be code
comments explaining why.
BTW, as a stylistic matter, I think it sucks to write
!float8_cmp_internal(x,y)
when what you mean is
float8_cmp_internal(x,y) == 0
The "!" syntax should pretty much only be used for boolean tests IMO.
I do recognize that there's a tradition of writing "!ptr" rather than
"ptr == NULL", which I think is all right in most contexts, mainly
because returning a null pointer has an element of boolean yes-or-no-ness
to it. When you're doing arithmetic comparisons, though, it's just
confusing.
I wrote another rant about this years ago in the context of complaining
about "!strcmp" tests; there was probably more detail in that, if you
care to look in the archives.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Andres Freund | 2013-09-06 22:22:41 | Re: [PERFORM] encouraging index-only scans |
Previous Message | Tom Lane | 2013-09-06 21:36:59 | Re: [RFC] Extend namespace of valid guc names |