Re: Change atoi to strtol in same place

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Joe Nelson <joe(at)begriffs(dot)com>
Cc: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, robertmhaas(at)gmail(dot)com, michael(at)paquier(dot)xyz, david(dot)rowley(at)2ndquadrant(dot)com, tomas(dot)vondra(at)2ndquadrant(dot)com, surafel3000(at)gmail(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Change atoi to strtol in same place
Date: 2019-10-04 15:33:08
Message-ID: 20191004153308.GA8828@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2019-Oct-03, Joe Nelson wrote:

> Kyotaro Horiguchi wrote:
> > > pg_standby: -k keepfiles could not parse 'hoge' as integer
> >
> > I didn't checked closely, but -k of pg_standby's message looks
> > somewhat strange. Needs a separator?
>
> Good point, how about this:
>
> pg_standby: -k keepfiles: <localized error message>

The wording is a bit strange. How about something like
pg_standy: invalid argument to -k: %s

where the %s is the error message produced like you propose:

> I could have pg_strtoint64_range() wrap its error messages in _() so
> that translators could customize the messages prior to concatenation.
>
> *error = psprintf(_("could not parse '%s' as integer"), str);

... except that they would rather be more explicit about what the
problem is. "insufficient digits" or "extraneous character", etc.

> Would this suffice?

I hope that no callers would like to have the messages not translated,
because that seems like it would become a mess.

--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2019-10-04 15:41:36 Re: Memory Accounting
Previous Message Jacob Champion 2019-10-04 15:30:21 Re: Proposal: Make use of C99 designated initialisers for nulls/values arrays