Re: [HACKERS] pgbench - allow to store select results into variables
Alvaro Herrera <alvherre@2ndquadrant.com>
From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Fabien COELHO <coelho@cri.ensmp.fr>
Cc: Pavel Stehule <pavel.stehule@gmail.com>, Tatsuo Ishii <ishii@sraoss.co.jp>, rafia.sabih@enterprisedb.com, Michael Paquier <michael.paquier@gmail.com>, Tom Lane <tgl@sss.pgh.pa.us>, Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>, Robert Haas <robertmhaas@gmail.com>, PostgreSQL Developers <pgsql-hackers@postgresql.org>
Date: 2018-11-16T21:43:07Z
Lists: pgsql-hackers
On 2017-Nov-04, Fabien COELHO wrote: > Think of one initialization followed by two appends: > > SELECT 1 AS x \cset > SELECT 2 \; SELECT 3 AS y \cset > SELECT 4 \; SELECT 5 \; SELECT 6 AS z \gset > > In the end, we must have the full 6 queries > > "SELECT 1 AS x \; SELECT 2 \; SELECT 3 AS y \; SELECT 4 \; SELECT 5 \; SELECT 6 AS z" > > and know that we want to set variables from queries 1, 3 and 6 and ignore > the 3 others. I'm not sure I understand this. Why is the "SELECT 2" ignored? (I can see why the 4 and 5 are ignored: they are not processed by gset). What exactly does \cset do? I thought "SELECT 2 \; SELECT 3 AS y \cset" would search for the \; and process *both* queries. I think the doc addition should be split. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Commits
-
pgbench: Remove \cset
- 25ee70511ec2 12.0 landed
-
pgbench: add \cset and \gset commands
- 6260cc550b0e 12.0 landed
-
Adjust pgbench to allow non-ASCII characters in variable names.
- 9d36a386608d 11.0 landed
-
Refactor script execution state machine in pgbench.
- 12788ae49e19 10.0 cited
-
Allow empty queries in pgbench.
- 6471045230f5 10.0 cited