Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit d55588e

Browse files
committed
Guard against transaction control statements in SQL functions. This
never worked, but it particularly doesn't work now.
1 parent 23645f0 commit d55588e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/backend/executor/functions.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/executor/functions.c,v 1.86 2004/08/29 05:06:42 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/executor/functions.c,v 1.87 2004/09/06 18:10:38 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -285,6 +285,11 @@ postquel_getnext(execution_state *es)
285285

286286
if (es->qd->operation == CMD_UTILITY)
287287
{
288+
/* Can't handle starting or committing a transaction */
289+
if (IsA(es->qd->parsetree->utilityStmt, TransactionStmt))
290+
ereport(ERROR,
291+
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
292+
errmsg("cannot begin/end transactions in SQL functions")));
288293
ProcessUtility(es->qd->parsetree->utilityStmt, es->qd->params,
289294
es->qd->dest, NULL);
290295
return NULL;

0 commit comments

Comments
 (0)