summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/backend/access/transam/xact.c13
-rw-r--r--src/backend/tcop/postgres.c18
2 files changed, 13 insertions, 18 deletions
diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c
index 423545e6038..ffe26e26f66 100644
--- a/src/backend/access/transam/xact.c
+++ b/src/backend/access/transam/xact.c
@@ -3406,6 +3406,16 @@ PreventInTransactionBlock(bool isTopLevel, const char *stmtType)
stmtType)));
/*
+ * inside a pipeline that has started an implicit transaction?
+ */
+ if (MyXactFlags & XACT_FLAGS_PIPELINING)
+ ereport(ERROR,
+ (errcode(ERRCODE_ACTIVE_SQL_TRANSACTION),
+ /* translator: %s represents an SQL statement name */
+ errmsg("%s cannot be executed within a pipeline",
+ stmtType)));
+
+ /*
* inside a function call?
*/
if (!isTopLevel)
@@ -3516,6 +3526,9 @@ IsInTransactionBlock(bool isTopLevel)
if (IsSubTransaction())
return true;
+ if (MyXactFlags & XACT_FLAGS_PIPELINING)
+ return true;
+
if (!isTopLevel)
return true;
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index d375d845b97..ec630b44916 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -2656,17 +2656,6 @@ start_xact_command(void)
xact_started = true;
}
- else if (MyXactFlags & XACT_FLAGS_PIPELINING)
- {
- /*
- * When the first Execute message is completed, following commands
- * will be done in an implicit transaction block created via
- * pipelining. The transaction state needs to be updated to an
- * implicit block if we're not already in a transaction block (like
- * one started by an explicit BEGIN).
- */
- BeginImplicitTransactionBlock();
- }
/*
* Start statement timeout if necessary. Note that this'll intentionally
@@ -4616,13 +4605,6 @@ PostgresMain(int argc, char *argv[],
case 'S': /* sync */
pq_getmsgend(&input_message);
-
- /*
- * If pipelining was used, we may be in an implicit
- * transaction block. Close it before calling
- * finish_xact_command.
- */
- EndImplicitTransactionBlock();
finish_xact_command();
send_ready_for_query = true;
break;