Re: pgbench - add \if support - Mailing list pgsql-hackers

From Fabien COELHO
Subject Re: pgbench - add \if support
Date
Msg-id alpine.DEB.2.20.1801081927360.22243@lancre
Whole thread Raw
In response to Re: pgbench - add \if support  (Dmitry Dolgov <9erthalion6@gmail.com>)
Responses Re: pgbench - add \if support
List 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.


pgsql-hackers by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: [HACKERS] VACUUM and ANALYZE disagreeing on what reltuples means
Next
From: Alexander Korotkov
Date:
Subject: Re: [HACKERS] [PATCH] Incremental sort