Re: extend pgbench expressions with functions - Mailing list pgsql-hackers

From Fabien COELHO
Subject Re: extend pgbench expressions with functions
Date
Msg-id alpine.DEB.2.10.1507252202530.25082@sto
Whole thread Raw
In response to Re: extend pgbench expressions with functions  (Heikki Linnakangas <hlinnaka@iki.fi>)
Responses Re: extend pgbench expressions with functions  (Fabien COELHO <coelho@cri.ensmp.fr>)
List pgsql-hackers
Hello Heikki,

> 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.

Here is a v8 with "abs", "min", "max", "random", "gaussian" et
"exponential".

There is no expression typing, but expressions are evaluated and cast to 
the expected type depending on what is needed (variables expect an int 
value, function arguments are usually int but for threshold...).

There is an evalDouble function to evaluate double arguments for 
gaussian & exponential thresholds.

There is a special "int" function which evaluates its argument as a double 
and cast the result to an int, for testing purpose.

Variables are only int values, and functions only return ints.

There is no real doc, WIP...

Also included are a set of sql stuff I used for minimal tests.

-- 
Fabien.

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Anyone working on the TOAST items on the TODO list?
Next
From: Bill Moran
Date:
Subject: Re: Anyone working on the TOAST items on the TODO list?