From: | Vik Fearing <vik(dot)fearing(at)2ndquadrant(dot)com> |
---|---|
To: | Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>, PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: pgbench - add \if support |
Date: | 2018-01-09 14:02:15 |
Message-ID: | 5f12699a-8ec0-8047-14fd-1d49c85f5a44@2ndquadrant.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 11/25/2017 10:33 PM, Fabien COELHO wrote:
>
> This patch adds \if support to pgbench, similar to psql's version added
> in March.
>
> This patch brings a consistent set of features especially when combined
> with two other patches already in the (slow) CF process:
>
> - https://commitfest.postgresql.org/10/596/ .. /15/985/
> adds support for booleans expressions (comparisons, logical
> operators, ...). This enhanced expression engine would be useful
> to allow client-side expression in psql.
>
> - https://commitfest.postgresql.org/10/669/ .. /15/669/
> adds support for \gset, so that pgbench can interact with a database
> and extract something into a variable, instead of discarding it.
>
> This patch adds a \if construct so that an expression on variables,
> possibly with data coming from the database, can change the behavior of
> a script.
I have given this patch a pretty good shake and I'm happy with it. I
did not test it with the other two patches, only on its own.
> A partial evaluation is performed to detect structural errors (eg
> missing endif, else after else...) when the script is parsed, so that
> such errors cannot occur when a script is running.
Very good.
> A new automaton state is added to quickly step over false branches.
This one took me a little while to understand while reading the patch,
but mostly because of how diff doesn't handle moving things around.
> TAP tests ensure reasonable coverage of the feature.
And the documentation seems sufficient, as well.
It's a shame this feature uses \elif instead of \elsif to be closer to
plpgsql, but I suppose this ship already sailed when psql chose \elif,
and I think it is correct that this patch follows psql.
Marking as ready for committer.
--
Vik Fearing +33 6 46 75 15 36
http://2ndQuadrant.fr PostgreSQL : Expertise, Formation et Support
From | Date | Subject | |
---|---|---|---|
Next Message | Fabien COELHO | 2018-01-09 14:36:20 | Re: pgbench - add \if support |
Previous Message | Fabien COELHO | 2018-01-09 13:46:24 | Re: pgbench - add \if support |