aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/libpq/fe-protocol3.c
diff options
context:
space:
mode:
authorPeter Eisentraut <peter@eisentraut.org>2023-06-15 13:54:37 +0200
committerPeter Eisentraut <peter@eisentraut.org>2023-06-15 13:54:37 +0200
commitd6326ba8fe69ced797412ea9bb97b2f35588f791 (patch)
tree4ad8e5fb13595064401455d7274c69e34b208bfa /src/interfaces/libpq/fe-protocol3.c
parentac68323a8788a881aa37671126346c08b1b08091 (diff)
downloadpostgresql-d6326ba8fe69ced797412ea9bb97b2f35588f791.tar.gz
postgresql-d6326ba8fe69ced797412ea9bb97b2f35588f791.zip
libpq: Fix up some error message coding
This applies the new error message API from commit 0873b2d354 to the changes introduced by bbf9c282ce. The latter was committed shortly after the former, so it probably didn't get the news in time.
Diffstat (limited to 'src/interfaces/libpq/fe-protocol3.c')
-rw-r--r--src/interfaces/libpq/fe-protocol3.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/interfaces/libpq/fe-protocol3.c b/src/interfaces/libpq/fe-protocol3.c
index 7222adabbab..32b66d561cb 100644
--- a/src/interfaces/libpq/fe-protocol3.c
+++ b/src/interfaces/libpq/fe-protocol3.c
@@ -1420,20 +1420,21 @@ pqGetNegotiateProtocolVersion3(PGconn *conn)
}
if (their_version < conn->pversion)
- appendPQExpBuffer(&conn->errorMessage,
- libpq_gettext("protocol version not supported by server: client uses %u.%u, server supports up to %u.%u\n"),
- PG_PROTOCOL_MAJOR(conn->pversion), PG_PROTOCOL_MINOR(conn->pversion),
- PG_PROTOCOL_MAJOR(their_version), PG_PROTOCOL_MINOR(their_version));
+ libpq_append_conn_error(conn, "protocol version not supported by server: client uses %u.%u, server supports up to %u.%u",
+ PG_PROTOCOL_MAJOR(conn->pversion), PG_PROTOCOL_MINOR(conn->pversion),
+ PG_PROTOCOL_MAJOR(their_version), PG_PROTOCOL_MINOR(their_version));
if (num > 0)
+ {
appendPQExpBuffer(&conn->errorMessage,
- libpq_ngettext("protocol extension not supported by server: %s\n",
- "protocol extensions not supported by server: %s\n", num),
+ libpq_ngettext("protocol extension not supported by server: %s",
+ "protocol extensions not supported by server: %s", num),
buf.data);
+ appendPQExpBufferChar(&conn->errorMessage, '\n');
+ }
/* neither -- server shouldn't have sent it */
if (!(their_version < conn->pversion) && !(num > 0))
- appendPQExpBuffer(&conn->errorMessage,
- libpq_gettext("invalid %s message"), "NegotiateProtocolVersion");
+ libpq_append_conn_error(conn, "invalid %s message", "NegotiateProtocolVersion");
termPQExpBuffer(&buf);
return 0;