Commit 051b4210 authored by Vadim B. Mikheev's avatar Vadim B. Mikheev

Fix for Hash and arrays

parent 435b9ed2
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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, ...@@ -98,7 +98,6 @@ ExecEvalArrayRef(ArrayRef *arrayRef,
int *lIndex; int *lIndex;
char *dataPtr; char *dataPtr;
execConstByVal = arrayRef->refelembyval;
*isNull = false; *isNull = false;
array_scanner = (ArrayType*)ExecEvalExpr(arrayRef->refexpr, array_scanner = (ArrayType*)ExecEvalExpr(arrayRef->refexpr,
econtext, econtext,
...@@ -138,6 +137,8 @@ ExecEvalArrayRef(ArrayRef *arrayRef, ...@@ -138,6 +137,8 @@ ExecEvalArrayRef(ArrayRef *arrayRef,
assgnexpr, econtext, assgnexpr, econtext,
isNull, &dummy); isNull, &dummy);
if (*isNull) return (Datum)NULL; if (*isNull) return (Datum)NULL;
execConstByVal = arrayRef->refelembyval;
execConstLen = arrayRef->refelemlength;
if (lIndex == NULL) if (lIndex == NULL)
return (Datum) array_set(array_scanner, i, upper.indx, dataPtr, return (Datum) array_set(array_scanner, i, upper.indx, dataPtr,
arrayRef->refelembyval, arrayRef->refelembyval,
...@@ -149,6 +150,8 @@ ExecEvalArrayRef(ArrayRef *arrayRef, ...@@ -149,6 +150,8 @@ ExecEvalArrayRef(ArrayRef *arrayRef,
arrayRef->refelembyval, arrayRef->refelembyval,
arrayRef->refelemlength, isNull); arrayRef->refelemlength, isNull);
} }
execConstByVal = arrayRef->refelembyval;
execConstLen = arrayRef->refelemlength;
if (lIndex == NULL) if (lIndex == NULL)
return (Datum) array_ref(array_scanner, i, upper.indx, return (Datum) array_ref(array_scanner, i, upper.indx,
arrayRef->refelembyval, arrayRef->refelembyval,
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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, ...@@ -536,8 +536,10 @@ ExecHashGetBucket(HashJoinTable hashtable,
/* ---------------- /* ----------------
* Get the join attribute value of the tuple * 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 * keyval could be null, so we better point it to something
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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) ...@@ -734,10 +734,16 @@ switch_outer(List *clauses)
Expr *temp = NULL; Expr *temp = NULL;
List *i = NIL; List *i = NIL;
Expr *clause; Expr *clause;
Node *op;
foreach(i,clauses) { foreach(i,clauses) {
clause = lfirst(i); 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, temp = make_clause(clause->opType, clause->oper,
lcons(get_rightop(clause), lcons(get_rightop(clause),
lcons(get_leftop(clause), lcons(get_leftop(clause),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment