From b8c326779246d6554a0868270639714cc4989a0e Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Mon, 19 Feb 2007 02:23:12 +0000 Subject: 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. --- src/backend/executor/nodeFunctionscan.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) (limited to 'src/backend/executor/nodeFunctionscan.c') diff --git a/src/backend/executor/nodeFunctionscan.c b/src/backend/executor/nodeFunctionscan.c index f7ca022f1c7..d3d9886e3c3 100644 --- a/src/backend/executor/nodeFunctionscan.c +++ b/src/backend/executor/nodeFunctionscan.c @@ -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; -- cgit v1.2.3