Re: Change atoi to strtol in same place

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

At Fri, 11 Oct 2019 23:27:54 -0500, Joe Nelson <joe(at)begriffs(dot)com> wrote in
> Here's v6 of the patch.
>
> [x] Rebase on 20961ceaf0
> [x] Don't call exit(1) after pg_fatal()
> [x] Use Tom Lane's suggestion for %lld in _() string
> [x] Allow full unsigned 16-bit range for ports (don't disallow ports 0-1023)
> [x] Explicitly cast parsed values to smaller integers

Thank you for the new version.

By the way in the upthread,

At Tue, 8 Oct 2019 01:46:51 -0500, Joe Nelson <joe(at)begriffs(dot)com> wrote in
> > I see Michael's patch is adding this new return type, but really, is
> > there a good reason why we need to do something special when the user
> > does not pass in an integer?

I agree to David in that it's better to avoid that kind of complexity
if possible. The significant point of separating them was that you
don't want to suggest a false value range for non-integer inputs.

Looking the latest patch, the wrong suggestions and the complexity
introduced by the %lld alternative are already gone. So I think we're
reaching the simple solution where pg_strtoint64_range doesn't need to
be involved in message building.

"<hoge> must be an integer in the range (mm .. xx)"

Doesn't the generic message work for all kinds of failure here?

# It is also easy for transators than the split message case.

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2019-10-17 09:13:19 Re: maintenance_work_mem used by Vacuum
Previous Message Michael Paquier 2019-10-17 08:50:24 Re: v12.0: segfault in reindex CONCURRENTLY