Re: Bug in pgbench prepared statements - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: Bug in pgbench prepared statements
Date
Msg-id ZW1eetlQA8Vd4jlf@paquier.xyz
Whole thread Raw
In response to Re: Bug in pgbench prepared statements  (Lev Kokotov <lev.kokotov@gmail.com>)
List 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
notexist)/' 
#   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

Attachment

pgsql-hackers by date:

Previous
From: torikoshia
Date:
Subject: Re: Separate memory contexts for relcache and catcache
Next
From: shveta malik
Date:
Subject: Re: Synchronizing slots from primary to standby