pgbench - allow empty queries

Started by Fabien COELHOover 9 years ago2 messages
#1Fabien COELHO
coelho@cri.ensmp.fr
2 attachment(s)

I wanted to test overheads on an empty query, but pgbench does not allow
it. I do not see why not.

The attached very minor patch allows empty queries.

--
Fabien.

Attachments:

pgbench-empty-query-1.sqlapplication/x-sql; name=pgbench-empty-query-1.sqlDownload
diff --git a/src/bin/pgbench/pgbench.c b/src/bin/pgbench/pgbench.c
index 87fb006..ea84909 100644
--- a/src/bin/pgbench/pgbench.c
+++ b/src/bin/pgbench/pgbench.c
@@ -1898,6 +1898,7 @@ top:
 			{
 				case PGRES_COMMAND_OK:
 				case PGRES_TUPLES_OK:
+				case PGRES_EMPTY_QUERY: /* may be used to test overheads */
 					break;		/* OK */
 				default:
 					fprintf(stderr, "client %d aborted in state %d: %s",
empty.sqlapplication/x-sql; name=empty.sqlDownload
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Fabien COELHO (#1)
Re: pgbench - allow empty queries

Fabien COELHO <coelho@cri.ensmp.fr> writes:

I wanted to test overheads on an empty query, but pgbench does not allow
it. I do not see why not.

I'm inclined to think this was probably a good thing before 9.6, as a
guard against accidentally writing an empty query into a script and
thus executing more queries than you meant to. However, with the new
end-of-command definition I think it's impossible to write an empty
query without an explicit ";", so it seems fine now. Pushed.

regards, tom lane

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers