From 6923d699bc3c46ca2c5d8c12fe1c5c39ecfee11d Mon Sep 17 00:00:00 2001
From: Tom Lane
Date: Tue, 31 May 2011 17:53:45 -0400
Subject: 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 | 2 ++
1 file changed, 2 insertions(+)
(limited to 'doc/src/sgml/gist.sgml')
diff --git a/doc/src/sgml/gist.sgml b/doc/src/sgml/gist.sgml
index f6e31092aa1..78171cfa3fd 100644
--- a/doc/src/sgml/gist.sgml
+++ b/doc/src/sgml/gist.sgml
@@ -378,6 +378,8 @@ my_decompress(PG_FUNCTION_ARGS)
Returns a value indicating the cost
of inserting the new
entry into a particular branch of the tree. Items will be inserted
down the path of least penalty in the tree.
+ Values returned by penalty should be non-negative.
+ If a negative value is returned, it will be treated as zero.
--
cgit v1.2.3