pgbench - allow to store select results into variables
Fabien COELHO <coelho@cri.ensmp.fr>
From: Fabien COELHO <coelho@cri.ensmp.fr>
To: PostgreSQL Developers <pgsql-hackers@postgresql.org>
Date: 2016-07-09T08:20:39Z
Lists: pgsql-hackers
Attachments
- pgbench-into-1.patch (text/x-diff) patch
- into.sql (application/x-sql)
- into-err-1.sql (application/x-sql)
- into-err-2.sql (application/x-sql)
- into-err-3.sql (application/x-sql)
- into-err-4.sql (application/x-sql)
- into-err-5.sql (application/x-sql)
- into-err-6.sql (application/x-sql)
Hello devs, I mentionned my intention to add some features to pgbench back in March: https://www.postgresql.org/message-id/alpine.DEB.2.10.1603301618570.5677@sto The attached patch adds an \into meta command to store results of preceding SELECTs into pgbench variables, so that they can be reused afterwards. The feature is useful to make more realistic scripts, currently pgbench script cannot really interact with the database as results are discarded. The chosen syntax is easy to understand and the implementation is quite light, with minimal impact on the code base. I think that this is a reasonnable compromise. The SELECTs must yield exactly one row, the number of variables must be less than the number of columns. Also attached a set of test scripts, especially to trigger various error cases. -- Fabien.
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