From c158421f3b152a89d5f2e411cbea07b2588b5c76 Mon Sep 17 00:00:00 2001 From: Yugo Nagata Date: Fri, 26 Sep 2025 10:43:01 +0900 Subject: [PATCH v14 2/4] pgbench: Fix assertion failure at using --verbose-errors in pipeline mode commandError() is called to report errors when they can be retried, and it previously assumed that errors are always detected during SQL command execution. However, in pipeline mode, an error may also be detected when a \endpipeline meta-command is executed. This caused an assertion failure. To fix this, it is now assumed that errors can also be detected in this case. --- src/bin/pgbench/pgbench.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/bin/pgbench/pgbench.c b/src/bin/pgbench/pgbench.c index f0a405ca129..36c52303a9a 100644 --- a/src/bin/pgbench/pgbench.c +++ b/src/bin/pgbench/pgbench.c @@ -3059,7 +3059,13 @@ commandFailed(CState *st, const char *cmd, const char *message) static void commandError(CState *st, const char *message) { - Assert(sql_script[st->use_file].commands[st->command]->type == SQL_COMMAND); + /* + * Errors should only be detected during an SQL command or the \endpipeline + * meta command. Any other case triggers an assertion failure. + */ + Assert(sql_script[st->use_file].commands[st->command]->type == SQL_COMMAND || + sql_script[st->use_file].commands[st->command]->meta == META_ENDPIPELINE); + pg_log_info("client %d got an error in command %d (SQL) of script %d; %s", st->id, st->command, st->use_file, message); } -- 2.43.0