Protect GIST logic that assumes penalty values can't be negative.

Tom Lane <tgl@sss.pgh.pa.us>

Commit: 6923d699bc3c46ca2c5d8c12fe1c5c39ecfee11d
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2011-05-31T21:53:45Z
Releases: 9.1.0
Protect GIST logic that assumes penalty values can't be negative.

Apparently sane-looking penalty code might return small negative values,
for example because of roundoff error.  This will confuse places like
gistchoose().  Prevent problems by clamping negative penalty values to
zero.  (Just to be really sure, I also made it force NaNs to zero.)
Back-patch to all supported branches.

Alexander Korotkov

Files

PathChange+/−
doc/src/sgml/gist.sgml modified +2 −0
src/backend/access/gist/gistutil.c modified +9 −2