On 03/06/2015 11:41 AM, Fabien COELHO wrote:
This patch extends pgbench expression with functions. Currently only one
"abs" function is added. The point is rather to bootstrap the
infrastructure for other functions (such as hash, random variants...) to
be added later.

I think it would actually be good to add at least some of those other functions in the initial patch. The infrastructure that this patch adds only supports arguments with a single argument, so it won't get us very far. Also, will we need non-integer (e.g. string, numeric, whatever) arguments for the functions? How about other datatypes for variables in general? Perhaps not, or if we do that can be a separate patch, but it's something to keep in mind. The pgbench script language is evolving into a full-blown Turing-complete programming language...

As an initial list of functions, I'd suggest:

abs(x)
min(x, y, ...)
max(x, y, ...)
random_uniform(min, max)
random_gaussian(min, max, threshold)
random_exponential(min, max, threshold)

Would that be enough to specify e.g. the

As soon as we add more functions, the way they are documented needs to be reworked too; we'll need to add a table in the manual to list them.

- Heikki



--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to