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

Commit4efcf47

Browse files
committed
Add 'Portal Close' message to pipelined PQsendQuery()
Commitacb7e4e added a new implementation for PQsendQuery so thatit works in pipeline mode (by using extended query protocol), but itbehaves differently from the 'Q' message (in simple query protocol) usedby regular implementation: the new one doesn't close the unnamed portal.Change the new code to have identical behavior to the old.Reported-by: Yura Sokolov <y.sokolov@postgrespro.ru>Author: Álvaro Herrera <alvherre@alvh.no-ip.org>Discussion:https://postgr.es/m/202106072107.d4i55hdscxqj@alvherre.pgsql
1 parent1632ea4 commit4efcf47

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

‎src/interfaces/libpq/fe-exec.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1329,7 +1329,8 @@ PQsendQueryInternal(PGconn *conn, const char *query, bool newQuery)
13291329
{
13301330
/*
13311331
* In pipeline mode we cannot use the simple protocol, so we send
1332-
* Parse, Bind, Describe Portal, Execute.
1332+
* Parse, Bind, Describe Portal, Execute, Close Portal (with the
1333+
* unnamed portal).
13331334
*/
13341335
if (pqPutMsgStart('P',conn)<0||
13351336
pqPuts("",conn)<0||
@@ -1355,6 +1356,11 @@ PQsendQueryInternal(PGconn *conn, const char *query, bool newQuery)
13551356
pqPutInt(0,4,conn)<0||
13561357
pqPutMsgEnd(conn)<0)
13571358
gotosendFailed;
1359+
if (pqPutMsgStart('C',conn)<0||
1360+
pqPutc('P',conn)<0||
1361+
pqPuts("",conn)<0||
1362+
pqPutMsgEnd(conn)<0)
1363+
gotosendFailed;
13581364

13591365
entry->queryclass=PGQUERY_EXTENDED;
13601366
entry->query=strdup(query);

‎src/test/modules/libpq_pipeline/traces/pipeline_abort.trace

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,15 @@ F26Parse "" "SELECT 1; SELECT 2" 0
3838
F12Bind "" "" 0 0 0
3939
F6Describe P ""
4040
F9Execute "" 0
41+
F6Close P ""
4142
F4Sync
4243
BNNErrorResponse S "ERROR" V "ERROR" C "42601" M "cannot insert multiple commands into a prepared statement" F "SSSS" L "SSSS" R "SSSS" \x00
4344
B5ReadyForQuery I
4445
F54Parse "" "SELECT 1.0/g FROM generate_series(3, -1, -1) g" 0
4546
F12Bind "" "" 0 0 0
4647
F6Describe P ""
4748
F9Execute "" 0
49+
F6Close P ""
4850
F4Sync
4951
B4ParseComplete
5052
B4BindComplete

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp