aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/nodeWindowAgg.c
diff options
context:
space:
mode:
authorAndres Freund <andres@anarazel.de>2017-01-19 14:12:38 -0800
committerAndres Freund <andres@anarazel.de>2017-01-19 14:40:41 -0800
commitea15e18677fc2eff3135023e27f69ed8821554ed (patch)
treeb6a3d56b7603b96a5841681f0121171844a1c41c /src/backend/executor/nodeWindowAgg.c
parent8eace46d34ab6ac0d887aa4d3504bc4222c2e448 (diff)
downloadpostgresql-ea15e18677fc2eff3135023e27f69ed8821554ed.tar.gz
postgresql-ea15e18677fc2eff3135023e27f69ed8821554ed.zip
Remove obsoleted code relating to targetlist SRF evaluation.
Since 69f4b9c plain expression evaluation (and thus normal projection) can't return sets of tuples anymore. Thus remove code dealing with that possibility. This will require adjustments in external code using ExecEvalExpr()/ExecProject() - that should neither be hard nor very common. Author: Andres Freund and Tom Lane Discussion: https://postgr.es/m/20160822214023.aaxz5l4igypowyri@alap3.anarazel.de
Diffstat (limited to 'src/backend/executor/nodeWindowAgg.c')
-rw-r--r--src/backend/executor/nodeWindowAgg.c58
1 files changed, 11 insertions, 47 deletions
diff --git a/src/backend/executor/nodeWindowAgg.c b/src/backend/executor/nodeWindowAgg.c
index 17884d2c44c..6ac6b83cddc 100644
--- a/src/backend/executor/nodeWindowAgg.c
+++ b/src/backend/executor/nodeWindowAgg.c
@@ -256,7 +256,7 @@ advance_windowaggregate(WindowAggState *winstate,
if (filter)
{
bool isnull;
- Datum res = ExecEvalExpr(filter, econtext, &isnull, NULL);
+ Datum res = ExecEvalExpr(filter, econtext, &isnull);
if (isnull || !DatumGetBool(res))
{
@@ -272,7 +272,7 @@ advance_windowaggregate(WindowAggState *winstate,
ExprState *argstate = (ExprState *) lfirst(arg);
fcinfo->arg[i] = ExecEvalExpr(argstate, econtext,
- &fcinfo->argnull[i], NULL);
+ &fcinfo->argnull[i]);
i++;
}
@@ -433,7 +433,7 @@ advance_windowaggregate_base(WindowAggState *winstate,
if (filter)
{
bool isnull;
- Datum res = ExecEvalExpr(filter, econtext, &isnull, NULL);
+ Datum res = ExecEvalExpr(filter, econtext, &isnull);
if (isnull || !DatumGetBool(res))
{
@@ -449,7 +449,7 @@ advance_windowaggregate_base(WindowAggState *winstate,
ExprState *argstate = (ExprState *) lfirst(arg);
fcinfo->arg[i] = ExecEvalExpr(argstate, econtext,
- &fcinfo->argnull[i], NULL);
+ &fcinfo->argnull[i]);
i++;
}
@@ -1584,15 +1584,12 @@ update_frametailpos(WindowObject winobj, TupleTableSlot *slot)
* ExecWindowAgg receives tuples from its outer subplan and
* stores them into a tuplestore, then processes window functions.
* This node doesn't reduce nor qualify any row so the number of
- * returned rows is exactly the same as its outer subplan's result
- * (ignoring the case of SRFs in the targetlist, that is).
+ * returned rows is exactly the same as its outer subplan's result.
* -----------------
*/
TupleTableSlot *
ExecWindowAgg(WindowAggState *winstate)
{
- TupleTableSlot *result;
- ExprDoneCond isDone;
ExprContext *econtext;
int i;
int numfuncs;
@@ -1601,23 +1598,6 @@ ExecWindowAgg(WindowAggState *winstate)
return NULL;
/*
- * Check to see if we're still projecting out tuples from a previous
- * output tuple (because there is a function-returning-set in the
- * projection expressions). If so, try to project another one.
- */
- if (winstate->ss.ps.ps_TupFromTlist)
- {
- TupleTableSlot *result;
- ExprDoneCond isDone;
-
- result = ExecProject(winstate->ss.ps.ps_ProjInfo, &isDone);
- if (isDone == ExprMultipleResult)
- return result;
- /* Done with that source tuple... */
- winstate->ss.ps.ps_TupFromTlist = false;
- }
-
- /*
* Compute frame offset values, if any, during first call.
*/
if (winstate->all_first)
@@ -1634,8 +1614,7 @@ ExecWindowAgg(WindowAggState *winstate)
Assert(winstate->startOffset != NULL);
value = ExecEvalExprSwitchContext(winstate->startOffset,
econtext,
- &isnull,
- NULL);
+ &isnull);
if (isnull)
ereport(ERROR,
(errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
@@ -1660,8 +1639,7 @@ ExecWindowAgg(WindowAggState *winstate)
Assert(winstate->endOffset != NULL);
value = ExecEvalExprSwitchContext(winstate->endOffset,
econtext,
- &isnull,
- NULL);
+ &isnull);
if (isnull)
ereport(ERROR,
(errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
@@ -1684,7 +1662,6 @@ ExecWindowAgg(WindowAggState *winstate)
winstate->all_first = false;
}
-restart:
if (winstate->buffer == NULL)
{
/* Initialize for first partition and set current row = 0 */
@@ -1776,17 +1753,8 @@ restart:
* evaluated with respect to that row.
*/
econtext->ecxt_outertuple = winstate->ss.ss_ScanTupleSlot;
- result = ExecProject(winstate->ss.ps.ps_ProjInfo, &isDone);
- if (isDone == ExprEndResult)
- {
- /* SRF in tlist returned no rows, so advance to next input tuple */
- goto restart;
- }
-
- winstate->ss.ps.ps_TupFromTlist =
- (isDone == ExprMultipleResult);
- return result;
+ return ExecProject(winstate->ss.ps.ps_ProjInfo);
}
/* -----------------
@@ -1896,8 +1864,6 @@ ExecInitWindowAgg(WindowAgg *node, EState *estate, int eflags)
ExecAssignResultTypeFromTL(&winstate->ss.ps);
ExecAssignProjectionInfo(&winstate->ss.ps, NULL);
- winstate->ss.ps.ps_TupFromTlist = false;
-
/* Set up data for comparing tuples */
if (node->partNumCols > 0)
winstate->partEqfunctions = execTuplesMatchPrepare(node->partNumCols,
@@ -2090,8 +2056,6 @@ ExecReScanWindowAgg(WindowAggState *node)
ExprContext *econtext = node->ss.ps.ps_ExprContext;
node->all_done = false;
-
- node->ss.ps.ps_TupFromTlist = false;
node->all_first = true;
/* release tuplestore et al */
@@ -2712,7 +2676,7 @@ WinGetFuncArgInPartition(WindowObject winobj, int argno,
}
econtext->ecxt_outertuple = slot;
return ExecEvalExpr((ExprState *) list_nth(winobj->argstates, argno),
- econtext, isnull, NULL);
+ econtext, isnull);
}
}
@@ -2811,7 +2775,7 @@ WinGetFuncArgInFrame(WindowObject winobj, int argno,
}
econtext->ecxt_outertuple = slot;
return ExecEvalExpr((ExprState *) list_nth(winobj->argstates, argno),
- econtext, isnull, NULL);
+ econtext, isnull);
}
}
@@ -2841,5 +2805,5 @@ WinGetFuncArgCurrent(WindowObject winobj, int argno, bool *isnull)
econtext->ecxt_outertuple = winstate->ss.ss_ScanTupleSlot;
return ExecEvalExpr((ExprState *) list_nth(winobj->argstates, argno),
- econtext, isnull, NULL);
+ econtext, isnull);
}