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

2025-11-21 Thread Álvaro Herrera
On 2025-Nov-21, Heikki Linnakangas wrote: > I don't feel the urge to refactor this myself right now, but we probably > could simplify this further. For example, I wonder if we should remove > is_an_int() altogether and rely on strtoi64() to return failure if the input > does't look like a integer.

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

2025-11-21 Thread Heikki Linnakangas
On 20/11/2025 05:36, Chao Li wrote: I have no concern if we decide to no longer support tailing spaces, while I still got a couple of small comments: 1 ``` -/* return whether str matches "^\s*[-+]?[0-9]+$" */ +/* + * Return whether str matches "^\s*[-+]?[0-9]+$" + * + * This should agree with s

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

2025-11-19 Thread Chao Li
> On Nov 19, 2025, at 23:37, Heikki Linnakangas wrote: > > Here's a small patch to replace the int64 parsing code in pgbench with a call > to strtoi64(). Makes it a little simpler. > > Spotted this while grepping for all the different integer parsing functions > we have. We could probably c

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

2025-11-19 Thread Neil Chen
On Thu, Nov 20, 2025 at 9:27 AM Tom Lane wrote: > > 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

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

2025-11-19 Thread Tom Lane
Neil Chen 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 accepte

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

2025-11-19 Thread Neil Chen
Hi, On Thu, Nov 20, 2025 at 8:57 AM Heikki Linnakangas wrote: > Here's a small patch to replace the int64 parsing code in pgbench with a > call to strtoi64(). Makes it a little simpler. > > +1 on this simplification – it definitely makes the code cleaner. One small note: the updated code doesn’t

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

2025-11-19 Thread Yuefei Shi
Hi Heikki: On Thu, Nov 20, 2025 at 8:45 AM Heikki Linnakangas wrote: > Here's a small patch to replace the int64 parsing code in pgbench with a > call to strtoi64(). Makes it a little simpler. > > Spotted this while grepping for all the different integer parsing > functions we have. We could pro

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

2025-11-19 Thread Heikki Linnakangas
() in pgbench, replacing its open-coded implementation Makes the code a little simpler. 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 o