Re: Make message strings in fe-connect.c consistent

From: Gurjeet Singh <gurjeet(at)singh(dot)im>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Postgres Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Make message strings in fe-connect.c consistent
Date: 2023-04-21 05:02:35
Message-ID: CABwTF4XdvoPH0H6TVe-rL5Pggasio66ArNpwvXdhMguZEZ4wEg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Apr 20, 2023 at 9:31 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Gurjeet Singh <gurjeet(at)singh(dot)im> writes:
> > When reviewing a recently committed patch [1] I noticed the odd usage
> > of a format specifier:
>
> > + libpq_append_conn_error(conn, "invalid %s value: \"%s\"",
> > + "load_balance_hosts",
> > + conn->load_balance_hosts);
>
> > The oddity is that the first %s is unnecessary, since the value we
> > want there is a constant. Typically a format specifier used to get the
> > value stored in a variable.
>
> This is actually intentional, on the grounds that it reduces the
> number of format strings that require translation.

That's the only reason I too could come up with.

> > There's just one exception to this pattern, though.
>
> >> libpq_append_conn_error(conn, "invalid require_auth method: \"%s\"",
> >> method);
>
> Yup, this one did not get the memo.

That explains why I could not find any translation for this error message.

Best regards,
Gurjeet http://Gurje.et
Postgres Contributors Team, http://aws.amazon.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Gurjeet Singh 2023-04-21 05:29:35 Minor code de-duplication in fe-connect.c
Previous Message Tom Lane 2023-04-21 04:31:01 Re: Make message strings in fe-connect.c consistent