diff options
author | Marc G. Fournier <scrappy@hub.org> | 1996-08-19 01:52:36 +0000 |
---|---|---|
committer | Marc G. Fournier <scrappy@hub.org> | 1996-08-19 01:52:36 +0000 |
commit | f796387b602c8d0c538eba6b96bf86c399c4cd36 (patch) | |
tree | b396eb71c6595fe4db14065f0c310e5dd033dfa3 /src/backend/executor/nodeHash.c | |
parent | 9848d3655d44aa2e58d28fe9f93a94b2934eedc8 (diff) | |
download | postgresql-f796387b602c8d0c538eba6b96bf86c399c4cd36.tar.gz postgresql-f796387b602c8d0c538eba6b96bf86c399c4cd36.zip |
|From: Dan McGuirk <mcguirk@indirect.com>
|
|This patch fixes a backend crash that happens sometimes when you try to
|join on a field that contains NULL in some rows. Postgres tries to
|compute a hash value of the field you're joining on, but when the field
|is NULL, the pointer it thinks is pointing to the data is really just
|pointing to random memory. This forces the hash value of NULL to be 0.
|
|It seems that nothing matches NULL on joins, even other NULL's (with or
|without this patch). Is that what's supposed to happen?
|
Diffstat (limited to 'src/backend/executor/nodeHash.c')
-rw-r--r-- | src/backend/executor/nodeHash.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/backend/executor/nodeHash.c b/src/backend/executor/nodeHash.c index 9ea00ed2371..6a476bac59e 100644 --- a/src/backend/executor/nodeHash.c +++ b/src/backend/executor/nodeHash.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/executor/nodeHash.c,v 1.3 1996/07/26 20:03:21 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/backend/executor/nodeHash.c,v 1.4 1996/08/19 01:52:36 scrappy Exp $ * *------------------------------------------------------------------------- */ @@ -527,6 +527,16 @@ ExecHashGetBucket(HashJoinTable hashtable, */ keyval = ExecEvalVar(hashkey, econtext, &isNull); + /* + * keyval could be null, so we better point it to something + * valid before trying to run hashFunc on it. --djm 8/17/96 + */ + if(isNull) { + execConstByVal = 0; + execConstLen = 0; + keyval = (Datum)""; + } + /* ------------------ * compute the hash function * ------------------ |