1
0
mirror of https://github.com/postgres/postgres.git synced 2025-12-12 02:37:31 +03:00

Add \shell and \setshell meta commands to pgbench.

\shell command runs an external shell command.
\setshell also does the same and sets the result to a variable.

original patch by Michael Paquier with some editorialization by Itagaki,
and reviewed by Greg Smith.
This commit is contained in:
Itagaki Takahiro
2009-12-15 07:17:57 +00:00
parent cddca5ec13
commit 7d67e06297
2 changed files with 208 additions and 6 deletions

View File

@@ -1,4 +1,4 @@
<!-- $PostgreSQL: pgsql/doc/src/sgml/pgbench.sgml,v 1.10 2009/08/03 18:30:55 tgl Exp $ -->
<!-- $PostgreSQL: pgsql/doc/src/sgml/pgbench.sgml,v 1.11 2009/12/15 07:17:57 itagaki Exp $ -->
<sect1 id="pgbench">
<title>pgbench</title>
@@ -466,6 +466,56 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
</varlistentry>
</variablelist>
<varlistentry>
<term>
<literal>\setshell <replaceable>varname</> <replaceable>command</> [ <replaceable>argument</> ... ]</literal>
</term>
<listitem>
<para>
Sets variable <replaceable>varname</> to the result of the shell command
<replaceable>command</>. The command must return an integer value
through its standard output.
</para>
<para>
<replaceable>argument</> can be either a text constant or a
<literal>:</><replaceable>variablename</> reference to a variable of
any types. If you want to use <replaceable>argument</> starting with
colons, you need to add an additional colon at the beginning of
<replaceable>argument</>.
</para>
<para>
Example:
<programlisting>
\setshell variable_to_be_assigned command literal_argument :variable ::literal_starting_with_colon
</programlisting>
</para>
</listitem>
</varlistentry>
</variablelist>
<varlistentry>
<term>
<literal>\shell <replaceable>command</> [ <replaceable>argument</> ... ]</literal>
</term>
<listitem>
<para>
Same as <literal>\setshell</literal>, but the result is ignored.
</para>
<para>
Example:
<programlisting>
\shell command literal_argument :variable ::literal_starting_with_colon
</programlisting>
</para>
</listitem>
</varlistentry>
</variablelist>
<para>
As an example, the full definition of the built-in TPC-B-like
transaction is: