diff options
author | Marc G. Fournier <scrappy@hub.org> | 1996-09-16 05:36:38 +0000 |
---|---|---|
committer | Marc G. Fournier <scrappy@hub.org> | 1996-09-16 05:36:38 +0000 |
commit | 906651f663669036a0a9680ff4105c5828c9190c (patch) | |
tree | 7afe961f8f5d753bed5c9944953116d51c7c963b /src/backend/executor/functions.c | |
parent | 475493130de825caf884d537d193d6b3ff8d0279 (diff) | |
download | postgresql-906651f663669036a0a9680ff4105c5828c9190c.tar.gz postgresql-906651f663669036a0a9680ff4105c5828c9190c.zip |
There is a bug in the function executor. The backend crashes while trying to
execute an sql function containing an utility command (create, notify, ...).
The bug is part in the planner, which returns a number of plans different
than the number of commands if there are utility commands in the query, and
in part in the function executor which assumes that all commands are normal
query commands and causes a SIGSEGV trying to execute commands without plan.
Submitted by: Massimo Dal Zotto <dz@cs.unitn.it>
Diffstat (limited to 'src/backend/executor/functions.c')
-rw-r--r-- | src/backend/executor/functions.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/src/backend/executor/functions.c b/src/backend/executor/functions.c index 2f6e29d8277..47baa11850a 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.1.1.1 1996/07/09 06:21:25 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/backend/executor/functions.c,v 1.2 1996/09/16 05:36:15 scrappy Exp $ * *------------------------------------------------------------------------- */ @@ -160,6 +160,14 @@ init_execution_state(FunctionCachePtr fcache, static TupleDesc postquel_start(execution_state *es) { +#ifdef FUNC_UTIL_PATCH + /* + * Do nothing for utility commands. (create, destroy...) DZ - 30-8-1996 + */ + if (es->qd->operation == CMD_UTILITY) { + return (TupleDesc) NULL; + } +#endif return ExecutorStart(es->qd, es->estate); } @@ -168,6 +176,17 @@ postquel_getnext(execution_state *es) { int feature; +#ifdef FUNC_UTIL_PATCH + if (es->qd->operation == CMD_UTILITY) { + /* + * Process an utility command. (create, destroy...) DZ - 30-8-1996 + */ + ProcessUtility(es->qd->parsetree->utilityStmt, es->qd->dest); + if (!LAST_POSTQUEL_COMMAND(es)) CommandCounterIncrement(); + return (TupleTableSlot*) NULL; + } +#endif + feature = (LAST_POSTQUEL_COMMAND(es)) ? EXEC_RETONE : EXEC_RUN; return ExecutorRun(es->qd, es->estate, feature, 0); @@ -176,6 +195,14 @@ postquel_getnext(execution_state *es) static void postquel_end(execution_state *es) { +#ifdef FUNC_UTIL_PATCH + /* + * Do nothing for utility commands. (create, destroy...) DZ - 30-8-1996 + */ + if (es->qd->operation == CMD_UTILITY) { + return; + } +#endif ExecutorEnd(es->qd, es->estate); } |