Re: pgbench - add \if support

From: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
To: Dmitry Dolgov <9erthalion6(at)gmail(dot)com>
Cc: Vik Fearing <vik(dot)fearing(at)2ndquadrant(dot)com>, PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: pgbench - add \if support
Date: 2018-01-08 18:36:41
Message-ID: alpine.DEB.2.20.1801081927360.22243@lancre
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Hello Dmitry,

> 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

Sure.

What you are trying to do is the result of combining the pgbench-if patch
and the pgbench-more-ops-and-funcs patch.

There is also with the ability to put the result of a SELECT into a
variable, which would then enable doing some if about data coming
from the database.

https://commitfest.postgresql.org/16/985/
https://commitfest.postgresql.org/16/669/
https://commitfest.postgresql.org/16/1385/

These are distinct entries in the CF, because they do quite distinct
things, and interact weakly one with the other.

However, it really makes full sense when they are all available together,
so I put an example which combines all three. "\if 1" is not that
interesting in itself, obviously.

Everytime I sent a (relatively) big patch in the past I was asked to cut
it in bites, which is tiresome when everything is intermixed, so now I'm
doing the bytes first.

--
Fabien.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Korotkov 2018-01-08 19:17:55 Re: [HACKERS] [PATCH] Incremental sort
Previous Message Tomas Vondra 2018-01-08 18:34:59 Re: [HACKERS] VACUUM and ANALYZE disagreeing on what reltuples means