pgsql: pgbench: add \cset and \gset commands

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

pgsql: pgbench: add \cset and \gset commands

Álvaro Herrera
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 <[hidden email]>
Reviewed-by: Stephen Frost <[hidden email]>
Reviewed-by: Pavel Stehule <[hidden email]>
Reviewed-by: Tom Lane <[hidden email]>
Reviewed-by: Tatsuo Ishii <[hidden email]>
Reviewed-by: Rafia Sabih <[hidden email]>



Modified Files
doc/src/sgml/ref/pgbench.sgml                |  85 +++++
src/bin/pgbench/pgbench.c                    | 545 ++++++++++++++++++++-------
src/bin/pgbench/t/ |  82 +++-
src/fe_utils/psqlscan.l                      |  24 +-
src/include/fe_utils/psqlscan.h              |   2 +
src/include/fe_utils/psqlscan_int.h          |   1 +
6 files changed, 602 insertions(+), 137 deletions(-)