Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit f796387

Browse files
committed
|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? |
1 parent 9848d36 commit f796387

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/backend/executor/nodeHash.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/executor/nodeHash.c,v 1.3 1996/07/26 20:03:21 scrappy Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/executor/nodeHash.c,v 1.4 1996/08/19 01:52:36 scrappy Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -527,6 +527,16 @@ ExecHashGetBucket(HashJoinTable hashtable,
527527
*/
528528
keyval = ExecEvalVar(hashkey, econtext, &isNull);
529529

530+
/*
531+
* keyval could be null, so we better point it to something
532+
* valid before trying to run hashFunc on it. --djm 8/17/96
533+
*/
534+
if(isNull) {
535+
execConstByVal = 0;
536+
execConstLen = 0;
537+
keyval = (Datum)"";
538+
}
539+
530540
/* ------------------
531541
* compute the hash function
532542
* ------------------

0 commit comments

Comments
 (0)