Re: [HACKERS] pow support for pgbench
Fabien COELHO <coelho@cri.ensmp.fr>
From: Fabien COELHO <coelho@cri.ensmp.fr>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Raúl Marín Rodríguez <rmrodriguez@carto.com>, Tom Lane <tgl@sss.pgh.pa.us>, Michael Paquier <michael.paquier@gmail.com>, Alvaro Herrera <alvherre@alvh.no-ip.org>, PostgreSQL mailing lists <pgsql-hackers@postgresql.org>
Date: 2017-12-06T05:58:00Z
Lists: pgsql-hackers
>> In both cases we'd return a double but we use the fast ipow if it's >> possible (which can be 20x faster), so at the cost of an extra cast if >> you need an int, we'd have a consistent API. Would this be acceptable? > > It seems OK to me. Computing as an int, casting to double and back to int8 can generate a loss of precision. However for powers of 2 it works exactly, so eg computing a mask it would be ok. This proposal does not exactly match SQL behavior, but I do not see this as a problem, which is why I was happy with the previous proposal. -- Fabien.
Commits
-
Add pow(), aka power(), function to pgbench.
- 7a727c180aa3 11.0 landed
-
pgbench: Support double constants and functions.
- 86c43f4e22c0 9.6.0 cited