pgsql: pgbench: Fix assertion failure with retriable errors in pipeline

From: Fujii Masao <fujii(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: pgbench: Fix assertion failure with retriable errors in pipeline
Date: 2025-09-26 12:26:13
Message-ID: E1v27Wf-000AV2-01@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

pgbench: Fix assertion failure with retriable errors in pipeline mode.

When running pgbench with --verbose-errors option and a custom script that
triggered retriable errors (e.g., serialization errors) in pipeline mode,
an assertion failure could occur:

Assertion failed: (sql_script[st->use_file].commands[st->command]->type == 1), function commandError, file pgbench.c, line 3062.

The failure happened because pgbench assumed these errors would only occur
during SQL commands, but in pipeline mode they can also happen during
\endpipeline meta command.

This commit fixes the assertion failure by adjusting the assertion check to
allow such errors during either SQL commands or \endpipeline.

Backpatch to v15, where the assertion check was introduced.

Author: Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp>
Reviewed-by: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Discussion: https://postgr.es/m/CAHGQGwGWQMOzNkQs-LmpDHdNC0h8dmAuUMRvZrEntQi5a-b=Kg@mail.gmail.com

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/c736808e03b77052f2e08f43210ba64517ff64d6

Modified Files
--------------
src/bin/pgbench/pgbench.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Fujii Masao 2025-09-26 12:26:25 pgsql: pgbench: Fix assertion failure with retriable errors in pipeline
Previous Message Fujii Masao 2025-09-26 12:25:55 pgsql: pgbench: Fix assertion failure with retriable errors in pipeline