From: | Robert Haas <robertmhaas(at)gmail(dot)com> |
---|---|
To: | Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr> |
Cc: | Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, PostgreSQL Developers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: add modulo (%) operator to pgbench |
Date: | 2014-09-09 14:45:08 |
Message-ID: | CA+TgmobhMsRtmQ6vZPGM+_Z2OqOsVoMc2TB1SRmsLbvOrLVGJg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, Aug 6, 2014 at 3:22 PM, Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr> wrote:
>> Maybe we ought to break down and support a real expression syntax.
>> Sounds like that would be better all around.
>
> Adding operators is more or less orthogonal with providing a new expression
> syntax. I'm not sure that there is currently a crying need for it (a
> syntax). It would be a significant project. It would raise the question
> "where to stop"... And I just really need a few more functions/operators
> which can be fitted in the current implementation quite easily.
Writing a simple expression parser for pgbench using flex and bison
would not be an inordinately difficult problem. And it would let you
add abs() and ?: and thereby avoid the need to hard-code multiple
versions of the modulo operator in the patch. The fact that you're
agonizing about which modulo to add is a sign that the language is too
impoverished to let you do anything non-trivial. That's why C only
has one modulo operator: as the patch demonstrates, the differences
between the version can be patched over with a very short C
expression. If we had real expressions in pgbench, you could do the
same thing there.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2014-09-09 14:45:31 | Re: Memory Alignment in Postgres |
Previous Message | Robert Haas | 2014-09-09 14:34:08 | Re: Join push-down support for foreign tables |