mirror of
https://github.com/postgres/postgres.git
synced 2025-07-03 20:02:46 +03:00
Put function expressions and values lists into FunctionScan and ValuesScan
plan nodes, so that the executor does not need to get these items from the range table at runtime. This will avoid needing to include these fields in the compact range table I'm expecting to make the executor use.
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeFunctionscan.c,v 1.42 2007/01/05 22:19:28 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeFunctionscan.c,v 1.43 2007/02/19 02:23:11 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -118,7 +118,6 @@ FunctionScanState *
|
||||
ExecInitFunctionScan(FunctionScan *node, EState *estate, int eflags)
|
||||
{
|
||||
FunctionScanState *scanstate;
|
||||
RangeTblEntry *rte;
|
||||
Oid funcrettype;
|
||||
TypeFuncClass functypclass;
|
||||
TupleDesc tupdesc = NULL;
|
||||
@ -161,17 +160,11 @@ ExecInitFunctionScan(FunctionScan *node, EState *estate, int eflags)
|
||||
ExecInitExpr((Expr *) node->scan.plan.qual,
|
||||
(PlanState *) scanstate);
|
||||
|
||||
/*
|
||||
* get info about function
|
||||
*/
|
||||
rte = rt_fetch(node->scan.scanrelid, estate->es_range_table);
|
||||
Assert(rte->rtekind == RTE_FUNCTION);
|
||||
|
||||
/*
|
||||
* Now determine if the function returns a simple or composite type, and
|
||||
* build an appropriate tupdesc.
|
||||
*/
|
||||
functypclass = get_expr_result_type(rte->funcexpr,
|
||||
functypclass = get_expr_result_type(node->funcexpr,
|
||||
&funcrettype,
|
||||
&tupdesc);
|
||||
|
||||
@ -185,7 +178,7 @@ ExecInitFunctionScan(FunctionScan *node, EState *estate, int eflags)
|
||||
else if (functypclass == TYPEFUNC_SCALAR)
|
||||
{
|
||||
/* Base data type, i.e. scalar */
|
||||
char *attname = strVal(linitial(rte->eref->colnames));
|
||||
char *attname = strVal(linitial(node->funccolnames));
|
||||
|
||||
tupdesc = CreateTemplateTupleDesc(1, false);
|
||||
TupleDescInitEntry(tupdesc,
|
||||
@ -197,9 +190,9 @@ ExecInitFunctionScan(FunctionScan *node, EState *estate, int eflags)
|
||||
}
|
||||
else if (functypclass == TYPEFUNC_RECORD)
|
||||
{
|
||||
tupdesc = BuildDescFromLists(rte->eref->colnames,
|
||||
rte->funccoltypes,
|
||||
rte->funccoltypmods);
|
||||
tupdesc = BuildDescFromLists(node->funccolnames,
|
||||
node->funccoltypes,
|
||||
node->funccoltypmods);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -221,7 +214,7 @@ ExecInitFunctionScan(FunctionScan *node, EState *estate, int eflags)
|
||||
* Other node-specific setup
|
||||
*/
|
||||
scanstate->tuplestorestate = NULL;
|
||||
scanstate->funcexpr = ExecInitExpr((Expr *) rte->funcexpr,
|
||||
scanstate->funcexpr = ExecInitExpr((Expr *) node->funcexpr,
|
||||
(PlanState *) scanstate);
|
||||
|
||||
scanstate->ss.ps.ps_TupFromTlist = false;
|
||||
|
Reference in New Issue
Block a user