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

Commit85d94c5

Browse files
committed
Avoid extra newline in errors received in FE protocol version 2.
Contrary to what the comment said, the postmaster does in fact end allits messages in a newline, since server version 7.2. Be tidy and don'tadd an extra newline if the error message already has one.Discussion:https://www.postgresql.org/message-id/CAFBsxsEdgMXc%2BtGfEy9Y41i%3D5pMMjKeH8t8vSAypR3ZnAoQnHg%40mail.gmail.com
1 parent3174d69 commit85d94c5

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3277,10 +3277,15 @@ PQconnectPoll(PGconn *conn)
32773277
conn->inStart=conn->inCursor;
32783278

32793279
/*
3280-
* The postmaster typically won't end its message with a
3281-
* newline, so add one to conform to libpq conventions.
3280+
* Before 7.2, the postmaster didn't always end its
3281+
* messages with a newline, so add one if needed to
3282+
* conform to libpq conventions.
32823283
*/
3283-
appendPQExpBufferChar(&conn->errorMessage,'\n');
3284+
if (conn->errorMessage.len==0||
3285+
conn->errorMessage.data[conn->errorMessage.len-1]!='\n')
3286+
{
3287+
appendPQExpBufferChar(&conn->errorMessage,'\n');
3288+
}
32843289

32853290
gotoerror_return;
32863291
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp