Commit d55588ea authored by Tom Lane's avatar Tom Lane

Guard against transaction control statements in SQL functions. This

never worked, but it particularly doesn't work now.
parent 23645f05
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/executor/functions.c,v 1.86 2004/08/29 05:06:42 momjian Exp $ * $PostgreSQL: pgsql/src/backend/executor/functions.c,v 1.87 2004/09/06 18:10:38 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -285,6 +285,11 @@ postquel_getnext(execution_state *es) ...@@ -285,6 +285,11 @@ postquel_getnext(execution_state *es)
if (es->qd->operation == CMD_UTILITY) if (es->qd->operation == CMD_UTILITY)
{ {
/* Can't handle starting or committing a transaction */
if (IsA(es->qd->parsetree->utilityStmt, TransactionStmt))
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("cannot begin/end transactions in SQL functions")));
ProcessUtility(es->qd->parsetree->utilityStmt, es->qd->params, ProcessUtility(es->qd->parsetree->utilityStmt, es->qd->params,
es->qd->dest, NULL); es->qd->dest, NULL);
return NULL; return NULL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment