Re: pgbench: using prepared BEGIN statement in a pipeline could cause an error

Alvaro Herrera <alvherre@alvh.no-ip.org>

From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Andres Freund <andres@anarazel.de>
Cc: Yugo NAGATA <nagata@sraoss.co.jp>, Tom Lane <tgl@sss.pgh.pa.us>, Fabien COELHO <coelho@cri.ensmp.fr>, pgsql-hackers@postgresql.org
Date: 2023-02-21T16:32:49Z
Lists: pgsql-hackers
On 2023-Feb-20, Alvaro Herrera wrote:

> Found one last problem: if you do "-f foobar.sql -M prepared" in that
> order, then the prepare fails because the statement names would not be
> assigned when the file is parsed.  This coding only supported doing
> "-M prepared -f foobar.sql", which funnily enough is the only one that
> PostgreSQL/Cluster.pm->pgbench() supports.  So I moved the prepared
> statement name generation to the postprocess step.

Pushed to all three branches -- thanks, Nagata-san, for diagnosing the
issue.

-- 
Álvaro Herrera         PostgreSQL Developer  —  https://www.EnterpriseDB.com/
"How strange it is to find the words "Perl" and "saner" in such close
proximity, with no apparent sense of irony. I doubt that Larry himself
could have managed it."         (ncm, http://lwn.net/Articles/174769/)



Commits

  1. Fix pgbench in prepared mode with an empty pipeline

  2. pgbench: Prepare commands in pipelines in advance

  3. Add -M (query mode) option per ITAGAKI Takahiro