From 782c16c6a154e760bf1608d633488538cd52da93 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Thu, 24 Aug 2000 03:29:15 +0000 Subject: SQL-language functions are now callable in ordinary fmgr contexts ... for example, an SQL function can be used in a functional index. (I make no promises about speed, but it'll work ;-).) Clean up and simplify handling of functions returning sets. --- src/pl/plpgsql/src/pl_exec.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/pl/plpgsql') diff --git a/src/pl/plpgsql/src/pl_exec.c b/src/pl/plpgsql/src/pl_exec.c index 0096b3825c..6c761c50f0 100644 --- a/src/pl/plpgsql/src/pl_exec.c +++ b/src/pl/plpgsql/src/pl_exec.c @@ -3,7 +3,7 @@ * procedural language * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.27 2000/08/13 02:50:35 tgl Exp $ + * $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.28 2000/08/24 03:29:15 tgl Exp $ * * This software is copyrighted by Jan Wieck - Hamburg. * @@ -2200,7 +2200,6 @@ exec_eval_simple_expr(PLpgSQL_execstate * estate, int fno; int i; bool isnull; - bool isdone; ExprContext *econtext; ParamListInfo paramLI; @@ -2274,9 +2273,7 @@ exec_eval_simple_expr(PLpgSQL_execstate * estate, * Initialize things * ---------- */ - *isNull = FALSE; *rettype = expr->plan_simple_type; - isdone = FALSE; /* ---------- * Clear the function cache @@ -2292,14 +2289,17 @@ exec_eval_simple_expr(PLpgSQL_execstate * estate, retval = ExecEvalExprSwitchContext(expr->plan_simple_expr, econtext, isNull, - &isdone); + NULL); SPI_pop(); /* * Copy the result out of the expression-evaluation memory context, * so that we can free the expression context. */ - retval = datumCopy(retval, get_typbyval(*rettype), get_typlen(*rettype)); + if (! *isNull) + retval = datumCopy(retval, + get_typbyval(*rettype), + get_typlen(*rettype)); FreeExprContext(econtext); -- cgit v1.2.1