Thread: pgsql: Protect GIST logic that assumes penalty values can't be negative

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

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/6923d699bc3c46ca2c5d8c12fe1c5c39ecfee11d

Modified Files
--------------
doc/src/sgml/gist.sgml             |    2 ++
src/backend/access/gist/gistutil.c |   11 +++++++++--
2 files changed, 11 insertions(+), 2 deletions(-)