[PATCH] pgbench: improve \sleep meta command

miyake_kouta <miyake_kouta@oss.nttdata.com>

From: miyake_kouta <miyake_kouta@oss.nttdata.com>
To: Pgsql Hackers <pgsql-hackers@postgresql.org>
Date: 2021-03-05T01:51:04Z
Lists: pgsql-hackers

Attachments

Hi.

I created a patch to improve \sleep meta command in pgbench.

There are two problems with the current pgbench implementation of 
\sleep.
First, when the input is like "\sleep foo s" , this string will be 
treated as 0 through atoi function, and no error will be raised.
Second, when the input is like "\sleep :some_bool s" and some_bool is 
set to True or False, this bool will be treated as 0 as well.
However, I think we should catch this error, so I suggest my patch to 
detect this and raise errors.

Regards.
--
Kota Miyake

Commits

  1. pgbench: Improve error-handling in \sleep command.