On Wed, Aug 6, 2014 at 3:22 PM, Fabien COELHO <coe...@cri.ensmp.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 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers