1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

pgbench: Remove \cset

Partial revert of commit 6260cc550b, "pgbench: add \cset and \gset
commands".

While \gset is widely considered a useful and necessary tool for user-
defined benchmarks, \cset does not have as much value, and its
implementation was considered "not to be up to project standards"
(though I, Álvaro, can't quite understand exactly how).  Therefore,
remove \cset.

Author: Fabien Coelho
Discussion: https://postgr.es/m/alpine.DEB.2.21.1903230716030.18811@lancre
Discussion: https://postgr.es/m/201901101900.mv7zduch6sad@alvherre.pgsql
This commit is contained in:
Alvaro Herrera
2019-03-25 12:16:07 -03:00
parent 6f97457e0d
commit 25ee70511e
6 changed files with 56 additions and 238 deletions

View File

@ -963,48 +963,6 @@ pgbench <optional> <replaceable>options</replaceable> </optional> <replaceable>d
</para>
<variablelist>
<varlistentry id='pgbench-metacommand-cset'>
<term>
<literal>\cset [<replaceable>prefix</replaceable>]</literal>
</term>
<listitem>
<para>
This command may be used to end SQL queries, replacing an embedded
semicolon (<literal>\;</literal>) within a compound SQL command.
</para>
<para>
When this command is used, the preceding SQL query is expected to
return one row, the columns of which are stored into variables named after
column names, and prefixed with <replaceable>prefix</replaceable> if provided.
</para>
<para>
The following example sends four queries as one compound SQL command,
inducing one message sent at the protocol level.
The result of the first query is stored into variable <replaceable>one</replaceable>,
the results of the third query are stored into variables <replaceable>z_three</replaceable>
and <replaceable>z_four</replaceable>,
whereas the results of the other queries are discarded.
<programlisting>
-- compound of four queries
SELECT 1 AS one \cset
SELECT 2 AS two \;
SELECT 3 AS three, 4 AS four \cset z_
SELECT 5;
</programlisting>
</para>
<note>
<para>
<literal>\cset</literal> does not work when empty SQL queries appear
within a compound SQL command.
</para>
</note>
</listitem>
</varlistentry>
<varlistentry id='pgbench-metacommand-gset'>
<term>
<literal>\gset [<replaceable>prefix</replaceable>]</literal>
@ -1012,8 +970,8 @@ SELECT 5;
<listitem>
<para>
This command may be used to end SQL queries, replacing a final semicolon
(<literal>;</literal>).
This command may be used to end SQL queries, taking the place of the
terminating semicolon (<literal>;</literal>).
</para>
<para>
@ -1026,7 +984,7 @@ SELECT 5;
The following example puts the final account balance from the first query
into variable <replaceable>abalance</replaceable>, and fills variables
<replaceable>p_two</replaceable> and <replaceable>p_three</replaceable>
with integers from the last query.
with integers from the third query.
The result of the second query is discarded.
<programlisting>
UPDATE pgbench_accounts
@ -1038,13 +996,6 @@ SELECT 1 \;
SELECT 2 AS two, 3 AS three \gset p_
</programlisting>
</para>
<note>
<para>
<literal>\gset</literal> does not work when empty SQL queries appear
within a compound SQL command.
</para>
</note>
</listitem>
</varlistentry>