Re: [HACKERS] pow support for pgbench

Fabien COELHO <coelho@cri.ensmp.fr>

From: Fabien COELHO <coelho@cri.ensmp.fr>
To: Raúl Marín Rodríguez <rmrodriguez@carto.com>
Cc: Robert Haas <robertmhaas@gmail.com>, Michael Paquier <michael.paquier@gmail.com>, Alvaro Herrera <alvherre@alvh.no-ip.org>, PostgreSQL mailing lists <pgsql-hackers@postgresql.org>
Date: 2017-12-04T15:47:34Z
Lists: pgsql-hackers
>> Please add the new function into the documentation table in 
>> alphabetical order.
>
> Fixed in the attached patch.

Yep. Patch applies cleanly. Make check & pgbench check ok. make html ok. 
POW is in the right place in the table, sorry I did not check before.

> What's the name of the backend function whose behavior this matches?
>
> As Fabien has mentioned, it tries to behave as "numeric_power". Maybe we 
> it'd better if we switch to "dpow" (which is pow with some error 
> handling) and always return a double. What do you think?

My 0.02€: I think that having a integer pow implementation when possible 
is a good think for pgbench, because the main use case is to deal with 
table keys in a benchmarking scripts, which are expected to be integers.

-- 
Fabien.

Commits

  1. Add pow(), aka power(), function to pgbench.

  2. pgbench: Support double constants and functions.