]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Back-patch fix to disallow BEGIN/COMMIT/ROLLBACK inside SQL functions.
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 6 Sep 2004 18:23:09 +0000 (18:23 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 6 Sep 2004 18:23:09 +0000 (18:23 +0000)
Not sure why this isn't causing serious problems in some simple tests,
but it definitely isn't going to do anything desirable...

src/backend/executor/functions.c

index 048a2609d7104a5882ee7f1dda146f17659c75ad..6346d1abc7662d3715e0fe2af18c52d80cd25240 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * 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)
        {
+               /* 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);
                return (TupleTableSlot *) NULL;
        }