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

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

Commit: 08779dc699634858d4940158f5de12e1c7ff1448
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2011-05-31T21:54:11Z
Releases: 8.2.22
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 +11 −3