From a933ee38bbb8dffbc48a3363a94ff6f2a9f7964d Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Thu, 16 Nov 2000 22:30:52 +0000 Subject: Change SearchSysCache coding conventions so that a reference count is maintained for each cache entry. A cache entry will not be freed until the matching ReleaseSysCache call has been executed. This eliminates worries about cache entries getting dropped while still in use. See my posting to pg-hackers of even date for more info. --- src/backend/executor/nodeHash.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/backend/executor/nodeHash.c') diff --git a/src/backend/executor/nodeHash.c b/src/backend/executor/nodeHash.c index 9cd85195cdc..1969c5f0bd6 100644 --- a/src/backend/executor/nodeHash.c +++ b/src/backend/executor/nodeHash.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * - * $Id: nodeHash.c,v 1.52 2000/08/24 03:29:03 tgl Exp $ + * $Id: nodeHash.c,v 1.53 2000/11/16 22:30:22 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -29,8 +29,8 @@ #include "executor/nodeHashjoin.h" #include "miscadmin.h" #include "parser/parse_expr.h" -#include "parser/parse_type.h" #include "utils/memutils.h" +#include "utils/lsyscache.h" static int hashFunc(Datum key, int len, bool byVal); @@ -237,7 +237,6 @@ ExecHashTableCreate(Hash *node) int totalbuckets; int bucketsize; int i; - Type typeInfo; MemoryContext oldcxt; /* ---------------- @@ -353,9 +352,9 @@ ExecHashTableCreate(Hash *node) * Get info about the datatype of the hash key. * ---------------- */ - typeInfo = typeidType(exprType(node->hashkey)); - hashtable->typByVal = typeByVal(typeInfo); - hashtable->typLen = typeLen(typeInfo); + get_typlenbyval(exprType(node->hashkey), + &hashtable->typLen, + &hashtable->typByVal); /* ---------------- * Create temporary memory contexts in which to keep the hashtable @@ -546,7 +545,9 @@ ExecHashGetBucket(HashJoinTable hashtable, } else { - bucketno = hashFunc(keyval, hashtable->typLen, hashtable->typByVal) + bucketno = hashFunc(keyval, + (int) hashtable->typLen, + hashtable->typByVal) % hashtable->totalbuckets; } -- cgit v1.2.3