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

Commitb8926a5

Browse files
author
Álvaro Herrera
committed
Remove assertion from PortalRunMulti
We have an assertion to ensure that a command tag has been assigned bythe time we're done executing, but if we happen to execute a commandwith no queries, the assertion would fail. Per discussion, rather thancontort things to get a tag assigned, just remove the assertion.Oversight in2f96613. That commit also retained a comment thatexplained logic that had been adjacent to it but diffused into variousplaces, leaving none apt to keep part of the comment. Remove that part,and rewrite what remains for extra clarity.Bug: #18984Backpatch-through: 13Reported-by: Aleksander Alekseev <aleksander@tigerdata.com>Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>Reviewed-by: Michaël Paquier <michael@paquier.xyz>Discussion:https://postgr.es/m/18984-0f4778a6599ac3ae@postgresql.org
1 parent26cc96d commitb8926a5

File tree

1 file changed

+8
-17
lines changed

1 file changed

+8
-17
lines changed

‎src/backend/tcop/pquery.c

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1350,24 +1350,15 @@ PortalRunMulti(Portal portal,
13501350
PopActiveSnapshot();
13511351

13521352
/*
1353-
* If a query completion data was supplied, use it. Otherwise use the
1354-
* portal's query completion data.
1355-
*
1356-
* Exception: Clients expect INSERT/UPDATE/DELETE tags to have counts, so
1357-
* fake them with zeros. This can happen with DO INSTEAD rules if there
1358-
* is no replacement query of the same type as the original. We print "0
1359-
* 0" here because technically there is no query of the matching tag type,
1360-
* and printing a non-zero count for a different query type seems wrong,
1361-
* e.g. an INSERT that does an UPDATE instead should not print "0 1" if
1362-
* one row was updated. See QueryRewrite(), step 3, for details.
1353+
* If a command tag was requested and we did not fill in a run-time-
1354+
* determined tag above, copy the parse-time tag from the Portal. (There
1355+
* might not be any tag there either, in edge cases such as empty prepared
1356+
* statements. That's OK.)
13631357
*/
1364-
if (qc&&qc->commandTag==CMDTAG_UNKNOWN)
1365-
{
1366-
if (portal->qc.commandTag!=CMDTAG_UNKNOWN)
1367-
CopyQueryCompletion(qc,&portal->qc);
1368-
/* If the caller supplied a qc, we should have set it by now. */
1369-
Assert(qc->commandTag!=CMDTAG_UNKNOWN);
1370-
}
1358+
if (qc&&
1359+
qc->commandTag==CMDTAG_UNKNOWN&&
1360+
portal->qc.commandTag!=CMDTAG_UNKNOWN)
1361+
CopyQueryCompletion(qc,&portal->qc);
13711362
}
13721363

13731364
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp