Skip to content

Commit d6326ba

Browse files
committed
libpq: Fix up some error message coding
This applies the new error message API from commit 0873b2d to the changes introduced by bbf9c28. The latter was committed shortly after the former, so it probably didn't get the news in time.
1 parent ac68323 commit d6326ba

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/interfaces/libpq/fe-protocol3.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1420,20 +1420,21 @@ pqGetNegotiateProtocolVersion3(PGconn *conn)
14201420
}
14211421

14221422
if (their_version < conn->pversion)
1423-
appendPQExpBuffer(&conn->errorMessage,
1424-
libpq_gettext("protocol version not supported by server: client uses %u.%u, server supports up to %u.%u\n"),
1425-
PG_PROTOCOL_MAJOR(conn->pversion), PG_PROTOCOL_MINOR(conn->pversion),
1426-
PG_PROTOCOL_MAJOR(their_version), PG_PROTOCOL_MINOR(their_version));
1423+
libpq_append_conn_error(conn, "protocol version not supported by server: client uses %u.%u, server supports up to %u.%u",
1424+
PG_PROTOCOL_MAJOR(conn->pversion), PG_PROTOCOL_MINOR(conn->pversion),
1425+
PG_PROTOCOL_MAJOR(their_version), PG_PROTOCOL_MINOR(their_version));
14271426
if (num > 0)
1427+
{
14281428
appendPQExpBuffer(&conn->errorMessage,
1429-
libpq_ngettext("protocol extension not supported by server: %s\n",
1430-
"protocol extensions not supported by server: %s\n", num),
1429+
libpq_ngettext("protocol extension not supported by server: %s",
1430+
"protocol extensions not supported by server: %s", num),
14311431
buf.data);
1432+
appendPQExpBufferChar(&conn->errorMessage, '\n');
1433+
}
14321434

14331435
/* neither -- server shouldn't have sent it */
14341436
if (!(their_version < conn->pversion) && !(num > 0))
1435-
appendPQExpBuffer(&conn->errorMessage,
1436-
libpq_gettext("invalid %s message"), "NegotiateProtocolVersion");
1437+
libpq_append_conn_error(conn, "invalid %s message", "NegotiateProtocolVersion");
14371438

14381439
termPQExpBuffer(&buf);
14391440
return 0;

0 commit comments

Comments
 (0)