Thread: pgsql: pgbench: Add a real expression syntax to \set

pgsql: pgbench: Add a real expression syntax to \set

From
Robert Haas
Date:
pgbench: Add a real expression syntax to \set

Previously, you could do \set variable operand1 operator operand2, but
nothing more complicated.  Now, you can \set variable expression, which
makes it much simpler to do multi-step calculations here.  This also
adds support for the modulo operator (%), with the same semantics as in
C.

Robert Haas and Fabien Coelho, reviewed by Álvaro Herrera and
Stephen Frost

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/878fdcb843e087cc1cdeadc987d6ef55202ddd04

Modified Files
--------------
contrib/pgbench/.gitignore  |    2 +
contrib/pgbench/Makefile    |   17 +++-
contrib/pgbench/exprparse.y |   96 +++++++++++++++++++
contrib/pgbench/exprscan.l  |  105 +++++++++++++++++++++
contrib/pgbench/pgbench.c   |  215 ++++++++++++++++++++++++++++---------------
contrib/pgbench/pgbench.h   |   56 +++++++++++
doc/src/sgml/pgbench.sgml   |   17 ++--
src/tools/msvc/Mkvcbuild.pm |    1 +
8 files changed, 425 insertions(+), 84 deletions(-)


Re: pgsql: pgbench: Add a real expression syntax to \set

From
Tom Lane
Date:
Robert Haas <rhaas@postgresql.org> writes:
> pgbench: Add a real expression syntax to \set

The makefile changes in this do not look right to me.  Files that are
meant to be shipped in the tarball should be removed by make
maintainer-clean, not an ordinary "make clean" which is what the committed
patch appears to do.  Otherwise, a tarball user without bison installed
would be cut off at the knees if he did "make clean" or "make distclean";
but those operations are not supposed to remove files that were in the
tarball.

            regards, tom lane


Re: pgsql: pgbench: Add a real expression syntax to \set

From
Fabien COELHO
Date:
> The makefile changes in this do not look right to me.  Files that are
> meant to be shipped in the tarball should be removed by make
> maintainer-clean, not an ordinary "make clean" which is what the committed
> patch appears to do.  Otherwise, a tarball user without bison installed
> would be cut off at the knees if he did "make clean" or "make distclean";
> but those operations are not supposed to remove files that were in the
> tarball.

Ooops, sorry, I'm probably responsible for the wrong EXTRA_CLEAN. I
definitely did not consider that clean was expected to leave the directory
to be compilable without flex/bison.

--
Fabien.


Re: pgsql: pgbench: Add a real expression syntax to \set

From
Robert Haas
Date:
On Mon, Mar 2, 2015 at 2:38 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Robert Haas <rhaas@postgresql.org> writes:
>> pgbench: Add a real expression syntax to \set
>
> The makefile changes in this do not look right to me.  Files that are
> meant to be shipped in the tarball should be removed by make
> maintainer-clean, not an ordinary "make clean" which is what the committed
> patch appears to do.  Otherwise, a tarball user without bison installed
> would be cut off at the knees if he did "make clean" or "make distclean";
> but those operations are not supposed to remove files that were in the
> tarball.

Hmm, yeah.  Also, it appears that the exprscan.h file doesn't actually
get (or need to be) generated here.  So I think we need something like
the attached.

Thought?

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Attachment

Re: pgsql: pgbench: Add a real expression syntax to \set

From
Fabien COELHO
Date:
> Also, it appears that the exprscan.h file doesn't actually
> get (or need to be) generated here.

Indeed.

>  So I think we need something like the attached.

There is a $(RM) make macro usually defined as "rm -f", but it does not
seem to be used elsewhere.

--
Fabien.


Re: pgsql: pgbench: Add a real expression syntax to \set

From
Tom Lane
Date:
Robert Haas <robertmhaas@gmail.com> writes:
> On Mon, Mar 2, 2015 at 2:38 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> The makefile changes in this do not look right to me.  Files that are
>> meant to be shipped in the tarball should be removed by make
>> maintainer-clean, not an ordinary "make clean" which is what the committed
>> patch appears to do.  Otherwise, a tarball user without bison installed
>> would be cut off at the knees if he did "make clean" or "make distclean";
>> but those operations are not supposed to remove files that were in the
>> tarball.

> Hmm, yeah.  Also, it appears that the exprscan.h file doesn't actually
> get (or need to be) generated here.  So I think we need something like
> the attached.

Looks OK to me.

            regards, tom lane