From: Vadim B. Mikheev Date: Tue, 22 Apr 1997 03:32:38 +0000 (+0000) Subject: Fix for Hash and arrays X-Git-Tag: REL6_1~285 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=051b4210e3cb3f3a9ec7cd5ab4503b48f279ab48;p=postgresql Fix for Hash and arrays --- diff --git a/src/backend/executor/execQual.c b/src/backend/executor/execQual.c index 7e9d6f0bac..9d943368a3 100644 --- a/src/backend/executor/execQual.c +++ b/src/backend/executor/execQual.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.10 1997/01/10 20:17:31 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.11 1997/04/22 03:32:35 vadim Exp $ * *------------------------------------------------------------------------- */ @@ -98,7 +98,6 @@ ExecEvalArrayRef(ArrayRef *arrayRef, int *lIndex; char *dataPtr; - execConstByVal = arrayRef->refelembyval; *isNull = false; array_scanner = (ArrayType*)ExecEvalExpr(arrayRef->refexpr, econtext, @@ -138,6 +137,8 @@ ExecEvalArrayRef(ArrayRef *arrayRef, assgnexpr, econtext, isNull, &dummy); if (*isNull) return (Datum)NULL; + execConstByVal = arrayRef->refelembyval; + execConstLen = arrayRef->refelemlength; if (lIndex == NULL) return (Datum) array_set(array_scanner, i, upper.indx, dataPtr, arrayRef->refelembyval, @@ -149,6 +150,8 @@ ExecEvalArrayRef(ArrayRef *arrayRef, arrayRef->refelembyval, arrayRef->refelemlength, isNull); } + execConstByVal = arrayRef->refelembyval; + execConstLen = arrayRef->refelemlength; if (lIndex == NULL) return (Datum) array_ref(array_scanner, i, upper.indx, arrayRef->refelembyval, diff --git a/src/backend/executor/nodeHash.c b/src/backend/executor/nodeHash.c index e3b004c0a2..c71c3a3f44 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.7 1996/11/06 06:47:40 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/backend/executor/nodeHash.c,v 1.8 1997/04/22 03:32:38 vadim Exp $ * *------------------------------------------------------------------------- */ @@ -536,8 +536,10 @@ ExecHashGetBucket(HashJoinTable hashtable, /* ---------------- * Get the join attribute value of the tuple * ---------------- + * ...It's quick hack - use ExecEvalExpr instead of ExecEvalVar: + * hashkey may be T_ArrayRef, not just T_Var. - vadim 04/22/97 */ - keyval = ExecEvalVar(hashkey, econtext, &isNull); + keyval = ExecEvalExpr((Node*)hashkey, econtext, &isNull, NULL); /* * keyval could be null, so we better point it to something diff --git a/src/backend/optimizer/plan/createplan.c b/src/backend/optimizer/plan/createplan.c index 2783e3917f..c56cc61c80 100644 --- a/src/backend/optimizer/plan/createplan.c +++ b/src/backend/optimizer/plan/createplan.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.9 1997/03/18 18:40:05 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.10 1997/04/22 03:30:36 vadim Exp $ * *------------------------------------------------------------------------- */ @@ -734,10 +734,16 @@ switch_outer(List *clauses) Expr *temp = NULL; List *i = NIL; Expr *clause; + Node *op; foreach(i,clauses) { clause = lfirst(i); - if(var_is_outer(get_rightop(clause))) { + op = (Node*)get_rightop(clause); + if ( IsA (op, ArrayRef) ) + op = ((ArrayRef*)op)->refexpr; + Assert ( IsA (op, Var) ); + if ( var_is_outer ((Var*)op) ) + { temp = make_clause(clause->opType, clause->oper, lcons(get_rightop(clause), lcons(get_leftop(clause),