From: Dmitrii Bondar <d.bondar@postgrespro.ru>
To: Robert Haas <robertmhaas@gmail.com>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: Pgbench: remove synchronous prepare
Date: Tue, 5 May 2026 14:48:30 +0700
Message-ID: <6cf1ae29-0992-4a14-a52f-b769b560b92a@postgrespro.ru> (raw)
In-Reply-To: <CA+TgmoYnWeA_jOOdebo=vfaCFAUYk2mMd5cPm4a_FnSMu_4ozA@mail.gmail.com>
References: <2da56b59-acb6-4ee3-af6b-6e800115dc7f@postgrespro.ru>
<d8b4e3b2-a21f-4989-9663-3689f0d4232b@postgrespro.ru>
<cdb264ce-acb5-4a20-bd69-5eb924bef253@postgrespro.ru>
<CA+TgmoZN2hfeqCrguSezTqPmxKE3jSf8Bnf1-o6ubexgVfj0sA@mail.gmail.com>
<6e161344-d26a-4e3d-aa12-83a05a3ca8dc@postgrespro.ru>
<CA+TgmoYnWeA_jOOdebo=vfaCFAUYk2mMd5cPm4a_FnSMu_4ozA@mail.gmail.com>
On 4/30/26 4:46 AM, Robert Haas wrote:
> Why isn't the solution to use the existing PQsendPrepare function
> instead of adding a new libpq entrypoint?
pgbench is not designed to process a response to a Parse message alone,
because of meta-commands. For example, the \gset command requires a
tuple to be stored, but a response to a Parse message does not provide
one. This leads to the error: pgbench: error: client 0 script 0 command
0 query 0: expected one row, got 0. Sending all additional messages with
PQsendQueryPrepared may look like the exact solution, but it is not.
PQsendQueryStart does not allow more than one command to be sent unless
pipeline mode is enabled. This could be fixed in two ways: either by
allowing libpq to send more than one command when pipeline is disabled,
or by adding a new state-machine state to pgbench. Both options seem
more invasive than the current solution. Adding a new libpq function
just for pgbench (at least for now) does not seem ideal either, but it
may be simpler and safer.
> I don't think we
> can add a function with a name like PQsendPBES, and I think we need to
I have other suggestions:
"PQsendQueryPrepare" but it is too close to the existing name
"PQsendQueryPrepared".
"PQsendPrepareQuery" similar to "PQsendPrepare" but it also executes the
query.
"PQsendPrepareExecute" is not especially well aligned with the existing
naming scheme, but it may describe the intent quite well.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: d.bondar@postgrespro.ru, robertmhaas@gmail.com, pgsql-hackers@lists.postgresql.org
Subject: Re: Pgbench: remove synchronous prepare
In-Reply-To: <6cf1ae29-0992-4a14-a52f-b769b560b92a@postgrespro.ru>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox