mirror of
https://github.com/postgres/postgres.git
synced 2025-06-06 00:02:36 -04:00
Avoid extra newline in errors received in FE protocol version 2.
Contrary to what the comment said, the postmaster does in fact end all its messages in a newline, since server version 7.2. Be tidy and don't add an extra newline if the error message already has one. Discussion: https://www.postgresql.org/message-id/CAFBsxsEdgMXc%2BtGfEy9Y41i%3D5pMMjKeH8t8vSAypR3ZnAoQnHg%40mail.gmail.com
This commit is contained in:
parent
3174d69fb9
commit
85d94c5753
@ -3277,10 +3277,15 @@ keep_going: /* We will come back to here until there is
|
|||||||
conn->inStart = conn->inCursor;
|
conn->inStart = conn->inCursor;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The postmaster typically won't end its message with a
|
* Before 7.2, the postmaster didn't always end its
|
||||||
* newline, so add one to conform to libpq conventions.
|
* messages with a newline, so add one if needed to
|
||||||
|
* conform to libpq conventions.
|
||||||
*/
|
*/
|
||||||
appendPQExpBufferChar(&conn->errorMessage, '\n');
|
if (conn->errorMessage.len == 0 ||
|
||||||
|
conn->errorMessage.data[conn->errorMessage.len - 1] != '\n')
|
||||||
|
{
|
||||||
|
appendPQExpBufferChar(&conn->errorMessage, '\n');
|
||||||
|
}
|
||||||
|
|
||||||
goto error_return;
|
goto error_return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user