pgbench: add \cset and \gset commands
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Thu, 10 Jan 2019 16:42:20 +0000 (13:42 -0300)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Thu, 10 Jan 2019 16:42:20 +0000 (13:42 -0300)
commit6260cc550b0e60052168518a0338e440b67cf24e
treeb908db71586754d3c877cc69463c47f6acf29912
parente1c1d5444e430375be9bc17366d17f1acd87ec0b
pgbench: add \cset and \gset commands

These commands allow assignment of values produced by queries to pgbench
variables, where they can be used by further commands.  \gset terminates
a command sequence (just like a bare semicolon); \cset separates
multiple queries in a compound command, like an escaped semicolon (\;).
A prefix can be provided to the \-command and is prepended to the name
of each output column to produce the final variable name.

This feature allows pgbench scripts to react meaningfully to the actual
database contents, allowing more powerful benchmarks to be written.

Authors: Fabien Coelho, Álvaro Herrera
Reviewed-by: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
Reviewed-by: Stephen Frost <sfrost@snowman.net>
Reviewed-by: Pavel Stehule <pavel.stehule@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Tatsuo Ishii <ishii@sraoss.co.jp>
Reviewed-by: Rafia Sabih <rafia.sabih@enterprisedb.com>
Discussion: https://postgr.es/m/alpine.DEB.2.20.1607091005330.3412@sto
doc/src/sgml/ref/pgbench.sgml
src/bin/pgbench/pgbench.c
src/bin/pgbench/t/001_pgbench_with_server.pl
src/fe_utils/psqlscan.l
src/include/fe_utils/psqlscan.h
src/include/fe_utils/psqlscan_int.h