From: Andres Freund Date: Thu, 31 Aug 2017 20:27:28 +0000 (-0700) Subject: Pass through PlanState parent to expression instantiation. X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=f0f4766679abcd55fbb117abfc97ccebf0522c80;p=users%2Fandresfreund%2Fpostgres.git Pass through PlanState parent to expression instantiation. --- diff --git a/src/backend/executor/execExpr.c b/src/backend/executor/execExpr.c index 81549ee915..b5bde3fa80 100644 --- a/src/backend/executor/execExpr.c +++ b/src/backend/executor/execExpr.c @@ -54,7 +54,7 @@ typedef struct LastAttnumInfo AttrNumber last_scan; } LastAttnumInfo; -static void ExecReadyExpr(ExprState *state); +static void ExecReadyExpr(ExprState *state, PlanState *parent); static void ExecInitExprRec(Expr *node, PlanState *parent, ExprState *state, Datum *resv, bool *resnull); static void ExprEvalPushStep(ExprState *es, const ExprEvalStep *s); @@ -123,6 +123,9 @@ ExecInitExpr(Expr *node, PlanState *parent) state = makeNode(ExprState); state->expr = node; + scratch.resvalue = NULL; + scratch.resnull = NULL; + /* Insert EEOP_*_FETCHSOME steps as needed */ ExecInitExprSlots(state, (Node *) node); @@ -133,7 +136,7 @@ ExecInitExpr(Expr *node, PlanState *parent) scratch.opcode = EEOP_DONE; ExprEvalPushStep(state, &scratch); - ExecReadyExpr(state); + ExecReadyExpr(state, parent); return state; } @@ -225,7 +228,7 @@ ExecInitQual(List *qual, PlanState *parent) scratch.opcode = EEOP_DONE; ExprEvalPushStep(state, &scratch); - ExecReadyExpr(state); + ExecReadyExpr(state, parent); return state; } @@ -316,6 +319,9 @@ ExecBuildProjectionInfo(List *targetList, state->expr = (Expr *) targetList; state->resultslot = slot; + scratch.resvalue = NULL; + scratch.resnull = NULL; + /* Insert EEOP_*_FETCHSOME steps as needed */ ExecInitExprSlots(state, (Node *) targetList); @@ -417,7 +423,7 @@ ExecBuildProjectionInfo(List *targetList, scratch.opcode = EEOP_DONE; ExprEvalPushStep(state, &scratch); - ExecReadyExpr(state); + ExecReadyExpr(state, parent); return projInfo; } @@ -571,9 +577,9 @@ ExecCheck(ExprState *state, ExprContext *econtext) * ExecReadyInterpretedExpr(). */ static void -ExecReadyExpr(ExprState *state) +ExecReadyExpr(ExprState *state, PlanState *parent) { - ExecReadyInterpretedExpr(state); + ExecReadyInterpretedExpr(state, parent); } /* @@ -2173,6 +2179,9 @@ ExecInitExprSlots(ExprState *state, Node *node) LastAttnumInfo info = {0, 0, 0}; ExprEvalStep scratch; + scratch.resvalue = NULL; + scratch.resnull = NULL; + /* * Figure out which attributes we're going to need. */ diff --git a/src/backend/executor/execExprInterp.c b/src/backend/executor/execExprInterp.c index 50e3f8b176..df453b2ab4 100644 --- a/src/backend/executor/execExprInterp.c +++ b/src/backend/executor/execExprInterp.c @@ -151,7 +151,7 @@ static Datum ExecJustAssignScanVar(ExprState *state, ExprContext *econtext, bool * Prepare ExprState for interpreted execution. */ void -ExecReadyInterpretedExpr(ExprState *state) +ExecReadyInterpretedExpr(ExprState *state, PlanState *parent) { /* Ensure one-time interpreter setup has been done */ ExecInitInterpreter();