>> Note that there is something for psql (src/bin/psql/variable.c) which
>> may or may not be shared. It should be checked before recoding
>> eventually the same thing.
>
> Thank you very much for pointing this file! As I checked this is another
> structure: here there's a simple list, while in pgbench we should know
> if the list is sorted and the number of elements in the list. How do you
> think, is it a good idea to name a variables structure in pgbench in the
> same way (VariableSpace) or it should be different not to be confused
> (Variables, for example)?
Given that the number of variables of a pgbench script is expected to be
pretty small, I'm not sure that the sorting stuff is worth the effort.
My suggestion is really to look at both implementations and to answer the
question "should pgbench share its variable implementation with psql?".
If the answer is yes, then the relevant part of the implementation should
be moved to fe_utils, and that's it.
If the answer is no, then implement something in pgbench directly.
--
Fabien.