1
0
mirror of https://github.com/postgres/postgres.git synced 2025-05-18 17:41:14 +03:00

Back-patch fix to disallow BEGIN/COMMIT/ROLLBACK inside SQL functions.

Not sure why this isn't causing serious problems in some simple tests,
but it definitely isn't going to do anything desirable...
This commit is contained in:
Tom Lane 2004-09-06 18:23:09 +00:00
parent aa1c232be7
commit 097597578e

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/functions.c,v 1.75 2003/09/25 18:58:35 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/executor/functions.c,v 1.75.2.1 2004/09/06 18:23:09 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -303,6 +303,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->dest, NULL); ProcessUtility(es->qd->parsetree->utilityStmt, es->qd->dest, NULL);
return (TupleTableSlot *) NULL; return (TupleTableSlot *) NULL;
} }