Re: Use strtoi64() in pgbench, replacing its open-coded implementation

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Neil Chen <carpenter.nail.cz@gmail.com>
Cc: Heikki Linnakangas <hlinnaka@iki.fi>, "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2025-11-20T01:27:09Z
Lists: pgsql-hackers
Neil Chen <carpenter.nail.cz@gmail.com> writes:
> +1 on this simplification – it definitely makes the code cleaner.
> One small note: the updated code doesn’t handle trailing spaces in the
> input string. Should we consider this a concern?

Heikki's draft commit message addresses that point:

    The old implementation accepted trailing whitespace, but that seemed
    unnecessary. Firstly, its sibling function for parsing decimals,
    strtodouble(), does not accept trailing whitespace. Secondly, none of
    the callers can pass a string with trailing whitespace to it.

I didn't try to verify the latter assertion, but if it's true,
we don't need the extra complication.

			regards, tom lane



Commits

  1. Use strtoi64() in pgbench, replacing its open-coded implementation