aboutsummaryrefslogtreecommitdiff
path: root/contrib/btree_gist/btree_cash.c
diff options
context:
space:
mode:
authorTeodor Sigaev <teodor@sigaev.ru>2005-07-01 13:44:56 +0000
committerTeodor Sigaev <teodor@sigaev.ru>2005-07-01 13:44:56 +0000
commitef770cbb6913cc4c816bb09acd7cb13f996281bd (patch)
treefe973e6aeb9c018d54ea6267f49d5d1b2d5d2f95 /contrib/btree_gist/btree_cash.c
parent8f6e8e8fed372a592f645d8900b6f456db82cc59 (diff)
downloadpostgresql-ef770cbb6913cc4c816bb09acd7cb13f996281bd.tar.gz
postgresql-ef770cbb6913cc4c816bb09acd7cb13f996281bd.zip
Fixes from Janko Richter <jankorichter@yahoo.de>
- Fix wrong index results on text, char, varchar for multibyte strings - Fix some SIGFPE signals - Add support for infinite timestamps - Because of locale settings, btree_gist can not be a prefix index anymore (for text). Each node holds now just the lower and upper boundary.
Diffstat (limited to 'contrib/btree_gist/btree_cash.c')
-rw-r--r--contrib/btree_gist/btree_cash.c17
1 files changed, 3 insertions, 14 deletions
diff --git a/contrib/btree_gist/btree_cash.c b/contrib/btree_gist/btree_cash.c
index 84e46101181..cef61037349 100644
--- a/contrib/btree_gist/btree_cash.c
+++ b/contrib/btree_gist/btree_cash.c
@@ -125,21 +125,10 @@ Datum
gbt_cash_penalty(PG_FUNCTION_ARGS)
{
cashKEY *origentry = (cashKEY *) DatumGetPointer(((GISTENTRY *) PG_GETARG_POINTER(0))->key);
- cashKEY *newentry = (cashKEY *) DatumGetPointer(((GISTENTRY *) PG_GETARG_POINTER(1))->key);
- float *result = (float *) PG_GETARG_POINTER(2);
+ cashKEY *newentry = (cashKEY *) DatumGetPointer(((GISTENTRY *) PG_GETARG_POINTER(1))->key);
+ float *result = (float *) PG_GETARG_POINTER(2);
- Cash res;
-
- *result = 0.0;
-
- penalty_range_enlarge(origentry->lower, origentry->upper, newentry->lower, newentry->upper);
-
- if (res > 0)
- {
- *result += FLT_MIN;
- *result += (float) (res / ((double) (res + origentry->upper - origentry->lower)));
- *result *= (FLT_MAX / (((GISTENTRY *) PG_GETARG_POINTER(0))->rel->rd_att->natts + 1));
- }
+ penalty_num(result,origentry->lower,origentry->upper,newentry->lower,newentry->upper);
PG_RETURN_POINTER(result);