Make libpq error messages consistent for translation
authorDaniel Gustafsson <[email protected]>
Fri, 21 Apr 2023 08:23:38 +0000 (10:23 +0200)
committerDaniel Gustafsson <[email protected]>
Fri, 21 Apr 2023 08:23:38 +0000 (10:23 +0200)
The errormessage for an incorrect require_auth method wasn't using the
common "invalid %s value" errormessage which lessens the burden on our
translators.  Fix by changing to that format to make use of existing
translations and to make error messages consistent in wording.

Reported and fixed by Gurjeet Singh with some tweaking by myself.

Author: Gurjeet Singh <[email protected]>
Discussion: https://postgr.es/m/CABwTF4Xu3g9zohJ9obu8m7MKbf8g63NgpRDjwqPHQgAtB+Gb8Q@mail.gmail.com

src/interfaces/libpq/fe-connect.c
src/test/authentication/t/001_password.pl

index fcd3d0d9a35ff592d58e67089be827cd826a3bf9..c713d11d30297f4cbf37c286ec5be9a97c164b76 100644 (file)
@@ -1407,8 +1407,8 @@ connectOptions2(PGconn *conn)
            else
            {
                conn->status = CONNECTION_BAD;
-               libpq_append_conn_error(conn, "invalid require_auth method: \"%s\"",
-                                       method);
+               libpq_append_conn_error(conn, "invalid %s value: \"%s\"",
+                                       "require_auth", method);
 
                free(part);
                return false;
index d7362a4d3edd5c5f31ba7c6f88661ad773b17a22..1306fd05d24aa344a410b4a7639071181a350d0f 100644 (file)
@@ -264,7 +264,7 @@ $node->connect_fails(
 $node->connect_fails(
    "user=scram_role require_auth=none,abcdefg",
    "unknown require_auth methods are rejected",
-   expected_stderr => qr/invalid require_auth method: "abcdefg"/);
+   expected_stderr => qr/invalid require_auth value: "abcdefg"/);
 
 # For plain "password" method, all users should also be able to connect.
 reset_pg_hba($node, 'all', 'all', 'password');