Re: pgbench - refactor init functions with buffers

Fabien COELHO <coelho@cri.ensmp.fr>

From: Fabien COELHO <coelho@cri.ensmp.fr>
To: Dilip Kumar <dilipbalaut@gmail.com>
Cc: PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>
Date: 2019-10-22T10:00:13Z
Lists: pgsql-hackers
Hello Dilip,

> - for (i = 0; i < nbranches * scale; i++)
> + for (int i = 0; i < nbranches * scale; i++)
> ...
> - for (i = 0; i < ntellers * scale; i++)
> + for (int i = 0; i < ntellers * scale; i++)
>  {
>
> I haven't read the complete patch.  But, I have noticed that many
> places you changed the variable declaration from c to c++ style (i.e
> moved the declaration in the for loop).  IMHO, generally in PG, we
> don't follow this convention.  Is there any specific reason to do
> this?

There are many places where it is used now in pg (120 occurrences in 
master, 7 in pgbench). I had a bug recently because of a stupidly reused 
index variable, so I tend to use this now it is admissible, moreover here 
I'm actually doing a refactoring patch, so it seems ok to include that.

-- 
Fabien.



Commits

  1. pgbench: Use PQExpBuffer to simplify code that constructs SQL.

  2. Make command order in test more sensible