diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2000-11-16 22:30:52 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2000-11-16 22:30:52 +0000 |
commit | a933ee38bbb8dffbc48a3363a94ff6f2a9f7964d (patch) | |
tree | 1c32737389b2530e7152dc2287161b36d9001e8c /src/backend/executor/nodeHash.c | |
parent | cff23842a4c68301ddf34559c7af383bb5557054 (diff) | |
download | postgresql-a933ee38bbb8dffbc48a3363a94ff6f2a9f7964d.tar.gz postgresql-a933ee38bbb8dffbc48a3363a94ff6f2a9f7964d.zip |
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.
Diffstat (limited to 'src/backend/executor/nodeHash.c')
-rw-r--r-- | src/backend/executor/nodeHash.c | 15 |
1 files changed, 8 insertions, 7 deletions
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; } |