1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-27 07:42:10 +03:00

Revert "Handle better implicit transaction state of pipeline mode"

This reverts commit d77f91214f on all stable branches, due to concerns
regarding the compatility side effects this could create in a minor
release.  The change still exists on HEAD.

Discussion: https://postgr.es/m/CA+TgmoZqRgeFTg4+Yf_CMRRXiHuNz1u6ZC4FvVk+rxw0RmOPnw@mail.gmail.com
Backpatch-through: 13
This commit is contained in:
Michael Paquier
2024-11-28 09:43:24 +09:00
parent 3bbfa2ef78
commit 6d1183515e
4 changed files with 23 additions and 184 deletions

View File

@@ -3489,6 +3489,16 @@ PreventInTransactionBlock(bool isTopLevel, const char *stmtType)
errmsg("%s cannot run inside a subtransaction",
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?
*/
@@ -3600,6 +3610,9 @@ IsInTransactionBlock(bool isTopLevel)
if (IsSubTransaction())
return true;
if (MyXactFlags & XACT_FLAGS_PIPELINING)
return true;
if (!isTopLevel)
return true;

View File

@@ -2746,17 +2746,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
@@ -4876,13 +4865,6 @@ PostgresMain(const char *dbname, const char *username)
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;