OSDN Git Service

Protect GIST logic that assumes penalty values can't be negative.
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 31 May 2011 21:53:45 +0000 (17:53 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 31 May 2011 21:53:45 +0000 (17:53 -0400)
commit6923d699bc3c46ca2c5d8c12fe1c5c39ecfee11d
tree52992a247d48ba2dc48068787d184820d5e61a51
parentba4cacf0756f71e175d25bac78834715a353e64e
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
doc/src/sgml/gist.sgml
src/backend/access/gist/gistutil.c