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.1510301756420.6545@sto
Whole thread Raw
In response to Re: extend pgbench expressions with functions  ("Shulgin, Oleksandr" <oleksandr.shulgin@zalando.de>)
Responses Re: extend pgbench expressions with functions  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
Here is a v12 which implements the suggestions below.

> Should we not allow for functions taking 0 arguments?  Since we're already
> into some math here, how about pi()? ;-)

Hmmm, why not.

> I understand requiring at least 1 arg simplifies the code a bit, but right
> now it reports syntax error for "random()", while it correctly reports
> unexpected number of arguments for "random(1,2,3)".  We would need another
> check for min() and max() which expect >=1 arguments, but it's easy to add.

Indeed, I had to add a special check.

> I would also argue that we should rename "random" to "rand" here to avoid
> confusion with the familiar SQL function "random()" that doesn't take
> arguments.

Why not, as it is also consistent with exporand() & gaussrand().

-- 
Fabien.

pgsql-hackers by date:

Previous
From: Kouhei Kaigai
Date:
Subject: Re: [DESIGN] ParallelAppend
Next
From: Josh Berkus
Date:
Subject: Re: Patch: Implement failover on libpq connect level.