]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
libpq: Message style improvements
authorPeter Eisentraut <peter@eisentraut.org>
Thu, 26 Jun 2025 20:13:53 +0000 (22:13 +0200)
committerPeter Eisentraut <peter@eisentraut.org>
Thu, 26 Jun 2025 20:13:53 +0000 (22:13 +0200)
src/interfaces/libpq/fe-connect.c
src/interfaces/libpq/fe-protocol3.c
src/interfaces/libpq/fe-secure-openssl.c

index ccb01aad3610974ee1d4f7727c5f41a7f761e1f4..51a9c41658455cf807c82e3f59834d9dfbeb23a7 100644 (file)
@@ -2141,7 +2141,7 @@ pqConnectOptions2(PGconn *conn)
        if (conn->min_pversion > conn->max_pversion)
        {
                conn->status = CONNECTION_BAD;
-               libpq_append_conn_error(conn, "min_protocol_version is greater than max_protocol_version");
+               libpq_append_conn_error(conn, "\"%s\" is greater than \"%s\"", "min_protocol_version", "max_protocol_version");
                return false;
        }
 
index beb1c889aad7395e892ffe941c94a445f10719b9..1599de757d1307c31ce0cbd48c895f4da2114438 100644 (file)
@@ -1434,7 +1434,7 @@ pqGetNegotiateProtocolVersion3(PGconn *conn)
        /* 3.1 never existed, we went straight from 3.0 to 3.2 */
        if (their_version == PG_PROTOCOL(3, 1))
        {
-               libpq_append_conn_error(conn, "received invalid protocol negotiation message: server requests downgrade to non-existent 3.1 protocol version");
+               libpq_append_conn_error(conn, "received invalid protocol negotiation message: server requested downgrade to non-existent 3.1 protocol version");
                goto failure;
        }
 
@@ -1452,9 +1452,10 @@ pqGetNegotiateProtocolVersion3(PGconn *conn)
 
        if (their_version < conn->min_pversion)
        {
-               libpq_append_conn_error(conn, "server only supports protocol version %d.%d, but min_protocol_version was set to %d.%d",
+               libpq_append_conn_error(conn, "server only supports protocol version %d.%d, but \"%s\" was set to %d.%d",
                                                                PG_PROTOCOL_MAJOR(their_version),
                                                                PG_PROTOCOL_MINOR(their_version),
+                                                               "min_protocol_version",
                                                                PG_PROTOCOL_MAJOR(conn->min_pversion),
                                                                PG_PROTOCOL_MINOR(conn->min_pversion));
 
@@ -1476,7 +1477,7 @@ pqGetNegotiateProtocolVersion3(PGconn *conn)
                }
                if (strncmp(conn->workBuffer.data, "_pq_.", 5) != 0)
                {
-                       libpq_append_conn_error(conn, "received invalid protocol negotiation message: server reported unsupported parameter name without a _pq_. prefix (\"%s\")", conn->workBuffer.data);
+                       libpq_append_conn_error(conn, "received invalid protocol negotiation message: server reported unsupported parameter name without a \"%s\" prefix (\"%s\")", "_pq_.", conn->workBuffer.data);
                        goto failure;
                }
                libpq_append_conn_error(conn, "received invalid protocol negotiation message: server reported an unsupported parameter that was not requested (\"%s\")", conn->workBuffer.data);
index 78f9e84eb353ba4f8e2ff8cfb05796747794e462..b08b3a6901b77a1dad627757c8de05fd4c343df7 100644 (file)
@@ -711,7 +711,7 @@ SSL_CTX_keylog_cb(const SSL *ssl, const char *line)
 
        if (fd == -1)
        {
-               libpq_append_conn_error(conn, "could not open ssl keylog file \"%s\": %s",
+               libpq_append_conn_error(conn, "could not open SSL key logging file \"%s\": %s",
                                                                conn->sslkeylogfile, pg_strerror(errno));
                return;
        }
@@ -719,7 +719,7 @@ SSL_CTX_keylog_cb(const SSL *ssl, const char *line)
        /* line is guaranteed by OpenSSL to be NUL terminated */
        rc = write(fd, line, strlen(line));
        if (rc < 0)
-               libpq_append_conn_error(conn, "could not write to ssl keylog file \"%s\": %s",
+               libpq_append_conn_error(conn, "could not write to SSL key logging file \"%s\": %s",
                                                                conn->sslkeylogfile, pg_strerror(errno));
        else
                rc = write(fd, "\n", 1);