Fabien COELHO wrote:
>
> >>[...] and that a subsequent -w modifies the meaning of the
> >>script-specifiying argument already read. That strikes me as a very
> >>unintuitive interface.
> >
> >Ok, I understand this "afterward modification" objection.
> >
> >What if the -w would be required *before*, and supply a weight for (the
> >first/maybe all) script(s) specified *afterwards*, so it does not modify
> >something already provided? I think it would be more intuitive, or at
> >least less surprising.
>
> Here is a v3 which does that. If there is a better idea, do not hesitate!
This seems a moderately reasonable interface to me. There are other
programs that behave in that way, and once you get used to the idea, it
makes sense.
I think for complete consistency we would have to require that -w is
specified for all scripts or none of them. I am not sure if this means
that it's okay to have later scripts use a weight specified for a
previous one (i.e. it's only an error to fail to specify a weight for
options before the first -w), or each -f must have always its own -w
explicitely. In other words, pg_bench -w2 -f script1.sql -f script2.sql
either script2 has weight 2, or it's an error, depending on what we
decide; but pg_bench -f script1.sql -w 2 -fscript2.sql
is always an error.
--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services