Bug in pgbench prepared statements - Mailing list pgsql-hackers

From Lev Kokotov
Subject Bug in pgbench prepared statements
Date
Msg-id CAPwLVyJhStdLU79dJyPJ52CGyTAXB463oV-b9mrCMLaK6uMbyQ@mail.gmail.com
Whole thread Raw
Responses Re: Bug in pgbench prepared statements
List pgsql-hackers
Hi,

I noticed something that looks like a bug in pgbench when using the prepared protocol. pgbench assumes that all prepared statements are prepared correctly, even if they contain errors (e.g. syntax, column/table doesn't exist, etc.).

My test script is just:

SELECT one;

The output looks something like this:

$ pgbench -f test.sql --protocol prepared -d postgres

[...]
pgbench: client 0 executing script "test.sql"
pgbench: client 0 preparing P_0
pgbench: error: ERROR:  column "one" does not exist

LINE 1: SELECT one;
               ^
pgbench: client 0 sending P_0
pgbench: client 0 receiving
pgbench: client 0 receiving
pgbench: error: client 0 script 0 aborted in command 0 query 0: ERROR:  prepared statement "P_0" does not exist
transaction type: test.sql
[...]

Normally this wouldn't be a big deal, although by itself the output is confusing, since the second error, while technically true, is not what caused the test run to fail. In my case, I was using pgbench to validate the correctness of prepared statements implementation in our pooler. Having the second error sent me on quite a debugging session until I realized that my fix was actually working.

Patch attached, if there is any interest in fixing this small bug.

Cheers!

Lev


Attachment

pgsql-hackers by date:

Previous
From: Kyotaro Horiguchi
Date:
Subject: about help message for new pg_dump's --filter option
Next
From: Kyotaro Horiguchi
Date:
Subject: Extra periods in pg_dump messages