diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2003-01-12 04:03:34 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2003-01-12 04:03:34 +0000 |
commit | 19b886332a76f6b1141a7c1ca1d9eacaa8ef40d2 (patch) | |
tree | 78461354b35c7517a50320b4ec4a0b6c13fead63 /src/backend/executor/execUtils.c | |
parent | 3e54e26bcf310ed619c893f4b69c8cf1591b53cc (diff) | |
download | postgresql-19b886332a76f6b1141a7c1ca1d9eacaa8ef40d2.tar.gz postgresql-19b886332a76f6b1141a7c1ca1d9eacaa8ef40d2.zip |
First cut at implementing IN (and NOT IN) via hashtables. There is
more to be done yet, but this is a good start.
Diffstat (limited to 'src/backend/executor/execUtils.c')
-rw-r--r-- | src/backend/executor/execUtils.c | 50 |
1 files changed, 36 insertions, 14 deletions
diff --git a/src/backend/executor/execUtils.c b/src/backend/executor/execUtils.c index 054ec703866..63eede22802 100644 --- a/src/backend/executor/execUtils.c +++ b/src/backend/executor/execUtils.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.94 2002/12/18 00:14:47 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.95 2003/01/12 04:03:34 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -476,28 +476,50 @@ ExecGetResultType(PlanState *planstate) } /* ---------------- - * ExecAssignProjectionInfo - forms the projection information from the node's targetlist + * ExecBuildProjectionInfo + * + * Build a ProjectionInfo node for evaluating the given tlist in the given + * econtext, and storing the result into the tuple slot. (Caller must have + * ensured that tuple slot has a descriptor matching the tlist!) Note that + * the given tlist should be a list of ExprState nodes, not Expr nodes. * ---------------- */ -void -ExecAssignProjectionInfo(PlanState *planstate) +ProjectionInfo * +ExecBuildProjectionInfo(List *targetList, + ExprContext *econtext, + TupleTableSlot *slot) { - ProjectionInfo *projInfo; - List *targetList; + ProjectionInfo *projInfo = makeNode(ProjectionInfo); int len; - targetList = planstate->targetlist; len = ExecTargetListLength(targetList); - projInfo = makeNode(ProjectionInfo); projInfo->pi_targetlist = targetList; - projInfo->pi_len = len; - projInfo->pi_tupValue = (len <= 0) ? NULL : (Datum *) palloc(sizeof(Datum) * len); - projInfo->pi_exprContext = planstate->ps_ExprContext; - projInfo->pi_slot = planstate->ps_ResultTupleSlot; + projInfo->pi_exprContext = econtext; + projInfo->pi_slot = slot; + if (len > 0) + { + projInfo->pi_tupValues = (Datum *) palloc(len * sizeof(Datum)); + projInfo->pi_tupNulls = (char *) palloc(len * sizeof(char)); + projInfo->pi_itemIsDone = (ExprDoneCond *) palloc(len * sizeof(ExprDoneCond)); + } + + return projInfo; +} - planstate->ps_ProjInfo = projInfo; +/* ---------------- + * ExecAssignProjectionInfo + * + * forms the projection information from the node's targetlist + * ---------------- + */ +void +ExecAssignProjectionInfo(PlanState *planstate) +{ + planstate->ps_ProjInfo = + ExecBuildProjectionInfo(planstate->targetlist, + planstate->ps_ExprContext, + planstate->ps_ResultTupleSlot); } |