summaryrefslogtreecommitdiff
path: root/src/backend/tcop/utility.c
diff options
context:
space:
mode:
authorPeter Eisentraut <peter_e@gmx.net>2018-03-24 10:05:06 -0400
committerPeter Eisentraut <peter_e@gmx.net>2018-03-28 13:31:27 -0400
commitd92bc83c48bdea9888e64cf1e2edbac9693099c9 (patch)
tree5cccf082581787b24af269613fb7b3cc4c4484d7 /src/backend/tcop/utility.c
parentc2d4eb1b1fa252fd8c407e1519308017a18afed1 (diff)
PL/pgSQL: Nested CALL with transactions
So far, a nested CALL or DO in PL/pgSQL would not establish a context where transaction control statements were allowed. This fixes that by handling CALL and DO specially in PL/pgSQL, passing the atomic/nonatomic execution context through and doing the required management around transaction boundaries. Reviewed-by: Tomas Vondra <tomas.vondra@2ndquadrant.com>
Diffstat (limited to 'src/backend/tcop/utility.c')
-rw-r--r--src/backend/tcop/utility.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/backend/tcop/utility.c b/src/backend/tcop/utility.c
index e144583bd1f..d355bef6060 100644
--- a/src/backend/tcop/utility.c
+++ b/src/backend/tcop/utility.c
@@ -382,7 +382,7 @@ standard_ProcessUtility(PlannedStmt *pstmt,
{
Node *parsetree = pstmt->utilityStmt;
bool isTopLevel = (context == PROCESS_UTILITY_TOPLEVEL);
- bool isAtomicContext = (context != PROCESS_UTILITY_TOPLEVEL || IsTransactionBlock());
+ bool isAtomicContext = (!(context == PROCESS_UTILITY_TOPLEVEL || context == PROCESS_UTILITY_QUERY_NONATOMIC) || IsTransactionBlock());
ParseState *pstate;
check_xact_readonly(parsetree);