Re: extend pgbench expressions with functions

From: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
To: "Shulgin, Oleksandr" <oleksandr(dot)shulgin(at)zalando(dot)de>
Cc: PostgreSQL Developers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: extend pgbench expressions with functions
Date: 2015-10-30 17:01:07
Message-ID: alpine.DEB.2.10.1510301756420.6545@sto
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

Attachment Content-Type Size
pgbench-expr-abs-12.patch text/x-diff 25.2 KB
functions.sql application/x-sql 714 bytes

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Josh Berkus 2015-10-30 17:21:53 Re: Patch: Implement failover on libpq connect level.
Previous Message Kouhei Kaigai 2015-10-30 16:35:26 Re: [DESIGN] ParallelAppend