Re: Bug in pgbench prepared statements

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Lev Kokotov <lev(dot)kokotov(at)gmail(dot)com>
Cc: Tristan Partin <tristan(at)neon(dot)tech>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Bug in pgbench prepared statements
Date: 2023-12-04 05:07:06
Message-ID: ZW1eetlQA8Vd4jlf@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Dec 01, 2023 at 07:06:40PM -0800, Lev Kokotov wrote:
> Attached. PR against master also here
> <https://github.com/postgres/postgres/pull/147>, just to make sure it's
> mergeable <https://github.com/postgres/postgres/pull/147.patch>.

Thanks for the updated patch. It looks sensible seen from here.

+ if (PQresultStatus(res) != PGRES_COMMAND_OK) {
pg_log_error("%s", PQerrorMessage(st->con));
+ return false;
+ }

Each bracket should be on its own line, that's the format used
elsewhere in the code.

Did you notice that this fails some of the regression tests? You can
enable these with --enable-tap-tests. Here is the failure:
[13:57:19.960](0.000s) not ok 241 - pgbench script error: sql syntax error stderr /(?^:prepared statement .* does not exist)/
[13:57:19.960](0.000s)
[13:57:19.960](0.000s) # Failed test 'pgbench script error: sql syntax error stderr /(?^:prepared statement .* does not exist)/'
# at t/001_pgbench_with_server.pl line 1150.
[13:57:19.960](0.000s) # 'pgbench: error: ERROR: syntax error at or near ";"
# LINE 1: SELECT 1 + ;
# ^
# pgbench: error: client 0 aborted in command 0 (SQL) of script 0; SQL command send failed
# pgbench: error: Run was aborted; the above results are incomplete.
# '
# doesn't match '(?^:prepared statement .* does not exist)'

The test case expects a syntax error as per its name, but we've just
bothered checking for the last pattern of the error generated since
it has been introduced in ed8a7c6fcf92. I would be more restrictive
and just update the error output in the test, to reflect the error we
want to show up, aka a "syntax error".
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message shveta malik 2023-12-04 05:10:33 Re: Synchronizing slots from primary to standby
Previous Message torikoshia 2023-12-04 04:59:07 Re: Separate memory contexts for relcache and catcache