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

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

Commit: 8057b7554bde98d887f02f5c0c7aeca01c8b52c9
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2011-05-31T21:54:01Z
Releases: 8.4.9
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