We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3174d69 commit 85d94c5Copy full SHA for 85d94c5
src/interfaces/libpq/fe-connect.c
@@ -3277,10 +3277,15 @@ PQconnectPoll(PGconn *conn)
3277
conn->inStart = conn->inCursor;
3278
3279
/*
3280
- * The postmaster typically won't end its message with a
3281
- * newline, so add one to conform to libpq conventions.
+ * Before 7.2, the postmaster didn't always end its
+ * messages with a newline, so add one if needed to
3282
+ * conform to libpq conventions.
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
+ }
3289
3290
goto error_return;
3291
}
0 commit comments