Re: pgbench - add \if support

Dmitry Dolgov <9erthalion6@gmail.com>

From: Dmitry Dolgov <9erthalion6@gmail.com>
To: Vik Fearing <vik.fearing@2ndquadrant.com>
Cc: Fabien COELHO <coelho@cri.ensmp.fr>, PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>
Date: 2018-01-08T17:39:49Z
Lists: pgsql-hackers
> On 4 January 2018 at 07:32, Fabien COELHO <coelho@cri.ensmp.fr> wrote:
>
> Another rebase to try to please the patch tester.

Thanks for working on this. I had just a quick look at it, but I hope I'll have
time to post a proper review. In the meantime I'm wondering what am I doing
wrong here (I see a similar example in your first message)?

```
-- test.sql
\if random(0, 99) < 85
    \set test 1
\else
    \set test 2
\endif
select :test;
```

```
$ pgbench -s 10 -f test.sql
test.sql:1: unexpected character (<) in command "if"
\if random(0, 99) < 85
                  ^ error found here
```

I'm using `pgbench-if-4.patch`, and everything is fine for simple
conditions like `\if 1`.


Commits

  1. Add \if support to pgbench