diff options
author | Vadim B. Mikheev <vadim4o@yahoo.com> | 1997-08-29 09:05:57 +0000 |
---|---|---|
committer | Vadim B. Mikheev <vadim4o@yahoo.com> | 1997-08-29 09:05:57 +0000 |
commit | 0d0254d1fbfb4878c877dd5fa15a0581a3e35c34 (patch) | |
tree | 29250a9cea7b99aaf2a81b8ff789097182406cdc /src/backend/executor/functions.c | |
parent | 3152996ffb8e9954927268b12f11814902e90166 (diff) | |
download | postgresql-0d0254d1fbfb4878c877dd5fa15a0581a3e35c34.tar.gz postgresql-0d0254d1fbfb4878c877dd5fa15a0581a3e35c34.zip |
SPI manager.
Diffstat (limited to 'src/backend/executor/functions.c')
-rw-r--r-- | src/backend/executor/functions.c | 48 |
1 files changed, 30 insertions, 18 deletions
diff --git a/src/backend/executor/functions.c b/src/backend/executor/functions.c index 19feea39e20..79f8bede085 100644 --- a/src/backend/executor/functions.c +++ b/src/backend/executor/functions.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/executor/functions.c,v 1.6 1997/08/12 22:52:35 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/executor/functions.c,v 1.7 1997/08/29 09:02:50 vadim Exp $ * *------------------------------------------------------------------------- */ @@ -365,9 +365,19 @@ postquel_execute(execution_state *es, Datum postquel_function(Func *funcNode, char **args, bool *isNull, bool *isDone) { - execution_state *es; - Datum result = 0; - FunctionCachePtr fcache = funcNode->func_fcache; + execution_state *es; + Datum result = 0; + FunctionCachePtr fcache = funcNode->func_fcache; + CommandId savedId; + + /* + * Before we start do anything we must save CurrentScanCommandId + * to restore it before return to upper Executor. Also, we have to + * set CurrentScanCommandId equal to CurrentCommandId. + * - vadim 08/29/97 + */ + savedId = GetScanCommandId (); + SetScanCommandId (GetCurrentCommandId ()); es = (execution_state *) fcache->func_state; if (es == NULL) @@ -401,22 +411,23 @@ postquel_function(Func *funcNode, char **args, bool *isNull, bool *isDone) * If we've gone through every command in this function, we are done. */ if (es == (execution_state *)NULL) + { + /* + * Reset the execution states to start over again + */ + es = (execution_state *)fcache->func_state; + while (es) { - /* - * Reset the execution states to start over again - */ - es = (execution_state *)fcache->func_state; - while (es) - { - es->status = F_EXEC_START; - es = es->next; - } - /* - * Let caller know we're finished. - */ - *isDone = true; - return (fcache->oneResult) ? result : (Datum)NULL; + es->status = F_EXEC_START; + es = es->next; } + /* + * Let caller know we're finished. + */ + *isDone = true; + SetScanCommandId (savedId); + return (fcache->oneResult) ? result : (Datum)NULL; + } /* * If we got a result from a command within the function it has * to be the final command. All others shouldn't be returing @@ -425,5 +436,6 @@ postquel_function(Func *funcNode, char **args, bool *isNull, bool *isDone) Assert ( LAST_POSTQUEL_COMMAND(es) ); *isDone = false; + SetScanCommandId (savedId); return result; } |