Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit24da0e7

Browse files
committed
Revert "Handle better implicit transaction state of pipeline mode"
This reverts commitd77f912 on all stable branches, due to concernsregarding the compatility side effects this could create in a minorrelease. The change still exists on HEAD.Discussion:https://postgr.es/m/CA+TgmoZqRgeFTg4+Yf_CMRRXiHuNz1u6ZC4FvVk+rxw0RmOPnw@mail.gmail.comBackpatch-through: 13
1 parentf1cb5e5 commit24da0e7

File tree

3 files changed

+23
-29
lines changed

3 files changed

+23
-29
lines changed

‎doc/src/sgml/protocol.sgml

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1088,17 +1088,16 @@ SELCT 1/0;<!-- this typo is intentional -->
10881088

10891089
<para>
10901090
If the client has not issued an explicit <command>BEGIN</command>,
1091-
then an implicit transaction block is started and each Sync ordinarily
1092-
causes an implicit <command>COMMIT</command> if the preceding step(s)
1093-
succeeded, or an implicit <command>ROLLBACK</command> if they failed.
1094-
This implicit transaction block will only be detected by the server
1095-
when the first command ends without a sync. There are a few DDL
1096-
commands (such as <command>CREATE DATABASE</command>) that cannot be
1097-
executed inside a transaction block. If one of these is executed in a
1098-
pipeline, it will fail unless it is the first command after a Sync.
1099-
Furthermore, upon success it will force an immediate commit to preserve
1100-
database consistency. Thus a Sync immediately following one of these
1101-
commands has no effect except to respond with ReadyForQuery.
1091+
then each Sync ordinarily causes an implicit <command>COMMIT</command>
1092+
if the preceding step(s) succeeded, or an
1093+
implicit <command>ROLLBACK</command> if they failed. However, there
1094+
are a few DDL commands (such as <command>CREATE DATABASE</command>)
1095+
that cannot be executed inside a transaction block. If one of
1096+
these is executed in a pipeline, it will fail unless it is the first
1097+
command in the pipeline. Furthermore, upon success it will force an
1098+
immediate commit to preserve database consistency. Thus a Sync
1099+
immediately following one of these commands has no effect except to
1100+
respond with ReadyForQuery.
11021101
</para>
11031102

11041103
<para>

‎src/backend/access/transam/xact.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3405,6 +3405,16 @@ PreventInTransactionBlock(bool isTopLevel, const char *stmtType)
34053405
errmsg("%s cannot run inside a subtransaction",
34063406
stmtType)));
34073407

3408+
/*
3409+
* inside a pipeline that has started an implicit transaction?
3410+
*/
3411+
if (MyXactFlags&XACT_FLAGS_PIPELINING)
3412+
ereport(ERROR,
3413+
(errcode(ERRCODE_ACTIVE_SQL_TRANSACTION),
3414+
/* translator: %s represents an SQL statement name */
3415+
errmsg("%s cannot be executed within a pipeline",
3416+
stmtType)));
3417+
34083418
/*
34093419
* inside a function call?
34103420
*/
@@ -3516,6 +3526,9 @@ IsInTransactionBlock(bool isTopLevel)
35163526
if (IsSubTransaction())
35173527
return true;
35183528

3529+
if (MyXactFlags&XACT_FLAGS_PIPELINING)
3530+
return true;
3531+
35193532
if (!isTopLevel)
35203533
return true;
35213534

‎src/backend/tcop/postgres.c

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2656,17 +2656,6 @@ start_xact_command(void)
26562656

26572657
xact_started= true;
26582658
}
2659-
elseif (MyXactFlags&XACT_FLAGS_PIPELINING)
2660-
{
2661-
/*
2662-
* When the first Execute message is completed, following commands
2663-
* will be done in an implicit transaction block created via
2664-
* pipelining. The transaction state needs to be updated to an
2665-
* implicit block if we're not already in a transaction block (like
2666-
* one started by an explicit BEGIN).
2667-
*/
2668-
BeginImplicitTransactionBlock();
2669-
}
26702659

26712660
/*
26722661
* Start statement timeout if necessary. Note that this'll intentionally
@@ -4616,13 +4605,6 @@ PostgresMain(int argc, char *argv[],
46164605

46174606
case'S':/* sync */
46184607
pq_getmsgend(&input_message);
4619-
4620-
/*
4621-
* If pipelining was used, we may be in an implicit
4622-
* transaction block. Close it before calling
4623-
* finish_xact_command.
4624-
*/
4625-
EndImplicitTransactionBlock();
46264608
finish_xact_command();
46274609
send_ready_for_query= true;
46284610
break;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp