Re: pgbench - add \if support

2018-03-22 Thread Teodor Sigaev
Thank you, pushed Fabien COELHO wrote: Hello Teodor, Patch seems usefull and commitable except comments in conditional.[ch]. I'd like to top/header comment in each file more detailed and descriptive. As for now it mentions only psql usage without explaining how it is basic or common.

Re: pgbench - add \if support

2018-03-21 Thread Fabien COELHO
Hello Teodor, Patch seems usefull and commitable except comments in conditional.[ch]. I'd like to top/header comment in each file more detailed and descriptive. As for now it mentions only psql usage without explaining how it is basic or common. Indeed, it was not updated. I've fixed the

Re: pgbench - add \if support

2018-03-01 Thread Andres Freund
Hi Fabien, Daniel, On 2018-03-01 18:47:04 +0100, Fabien COELHO wrote: > > > 0040 62 65 6e 63 68 2e 73 67 6d 6c 0d 0a 69 6e 64 65 Thanks for the analysis. > Hmmm. "0d 0a" looks bad. It does. TBQH the aesthetics of seing ^M's all over is what made me complain ;) > I've meddled into

Re: pgbench - add \if support

2018-03-01 Thread Fabien COELHO
0040 62 65 6e 63 68 2e 73 67 6d 6c 0d 0a 69 6e 64 65 Hmmm. "0d 0a" looks bad. I've meddled into "/etc/mime.types" to change "text/x-diff" to "text/plain" used by some other mailers. Here is the v6 version again, size is 38424 and md5sum is 63d79c0d5a93294f002edc640a3f525b. --

Re: pgbench - add \if support

2018-03-01 Thread Daniel Verite
Fabien COELHO wrote: > There does not seem to be any on my side: > > sh> hexdump pgbench-if-6.patch | grep '0[ad]' | head -3 > 040 6562 636e 2e68 6773 6c6d 690a 646e 7865 > 060 2031 3031 3630 3434 2d0a 2d2d 6120 642f > 080 6770 6562 636e 2e68 6773 6c6d 2b0a 2b2b

Re: pgbench - add \if support

2018-03-01 Thread Fabien COELHO
Hello Andres, Here is a very minor rebase. Your recent patches all seem to have windows line-endings. There does not seem to be any on my side: sh> hexdump pgbench-if-6.patch | grep '0[ad]' | head -3 040 6562 636e 2e68 6773 6c6d 690a 646e 7865 060 2031 3031 3630 3434

Re: pgbench - add \if support

2018-03-01 Thread Andres Freund
Hi, On 2018-01-15 18:28:09 +0100, Fabien COELHO wrote: > Here is a very minor rebase. Your recent patches all seem to have windows line-endings. It'd be good to fix that for the future... - Andres

Re: pgbench - add \if support

2018-01-22 Thread Pavel Stehule
2018-01-22 10:45 GMT+01:00 Fabien COELHO : > > few scripting features doesn't mean scripting language. \if in psql is nice >> feature that reduce duplicate code, unreadable code, and helps with >> deployment and test scripts. pgbench and psql should to have similar >>

Re: pgbench - add \if support

2018-01-21 Thread Pavel Stehule
2018-01-21 23:31 GMT+01:00 Craig Ringer : > On 16 January 2018 at 06:28, Fabien COELHO wrote: > >> >> Here is a rebase. I made some tests use actual expressions instead of just 0 and 1. No other changes. >>> >>> Sigh. Better with the

Re: pgbench - add \if support

2018-01-21 Thread Fabien COELHO
Helo Craig, I'm a smidge worried about this. It seems like psql is growing a scripting language. The patch is about aligning pgbench with psql, which already has \if. Do we want to go our own way with a kind of organically grown scripting system? Or should we be looking at embedding

Re: pgbench - add \if support

2018-01-21 Thread Craig Ringer
On 16 January 2018 at 06:28, Fabien COELHO wrote: > > Here is a rebase. I made some tests use actual expressions instead of just >>> 0 and 1. No other changes. >>> >> >> Sigh. Better with the attachment. Sorry for the noise. >> > > Here is a very minor rebase. > I'm a

Re: pgbench - add \if support

2018-01-15 Thread Fabien COELHO
Here is a rebase. I made some tests use actual expressions instead of just 0 and 1. No other changes. Sigh. Better with the attachment. Sorry for the noise. Here is a very minor rebase. -- Fabien.diff --git a/doc/src/sgml/ref/pgbench.sgml b/doc/src/sgml/ref/pgbench.sgml index

Re: pgbench - add \if support

2018-01-12 Thread Fabien COELHO
Hm, isn't already commited when/case/then/else syntax do the same? No, not strictly. The "CASE WHEN" is an if *within* an expression: \set i CASE WHEN condition THEN val1 ELSE val2 END The \if is at the script level, like psql already available version, which can change what SQL is sent.

Re: pgbench - add \if support

2018-01-12 Thread Teodor Sigaev
Hi! Hm, isn't already commited when/case/then/else syntax do the same? If not, could it be added to existing synax? Fabien COELHO wrote: Here is a rebase. I made some tests use actual expressions instead of just 0 and 1. No other changes. Sigh. Better with the attachment. Sorry for the

Re: pgbench - add \if support

2018-01-10 Thread Fabien COELHO
Here is a rebase. I made some tests use actual expressions instead of just 0 and 1. No other changes. Sigh. Better with the attachment. Sorry for the noise. -- Fabien.diff --git a/doc/src/sgml/ref/pgbench.sgml b/doc/src/sgml/ref/pgbench.sgml index 3dd492c..c203c41 100644 ---

Re: pgbench - add \if support

2018-01-10 Thread Fabien COELHO
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. "git diff -w --patience" may help. Marking as ready for committer. Here is a

Re: pgbench - add \if support

2018-01-09 Thread Fabien COELHO
Hello Vik, 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.

Re: pgbench - add \if support

2018-01-09 Thread Vik Fearing
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: > >  -

Re: pgbench - add \if support

2018-01-09 Thread Fabien COELHO
Hello Dmitry, What you are trying to do is the result of combining the pgbench-if patch and the pgbench-more-ops-and-funcs patch. Oh, I see. I missed the first message about this patch, sorry. But for some reason I can't apply both patches (pgbench-more-ops-funcs-23.patch and

Re: pgbench - add \if support

2018-01-09 Thread Dmitry Dolgov
> On 8 January 2018 at 19:36, Fabien COELHO wrote: > What you are trying to do is the result of combining the pgbench-if patch > and the pgbench-more-ops-and-funcs patch. Oh, I see. I missed the first message about this patch, sorry. But for some reason I can't apply both

Re: pgbench - add \if support

2018-01-08 Thread Fabien COELHO
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

Re: pgbench - add \if support

2018-01-08 Thread Dmitry Dolgov
> On 4 January 2018 at 07:32, Fabien COELHO 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

Re: pgbench - add \if support

2017-12-29 Thread Fabien COELHO
Another rebase after the pow function commit. Mostly a rebase after zipfian function commit. -- Fabien.diff --git a/doc/src/sgml/ref/pgbench.sgml b/doc/src/sgml/ref/pgbench.sgml index 1519fe7..7068063 100644 --- a/doc/src/sgml/ref/pgbench.sgml +++ b/doc/src/sgml/ref/pgbench.sgml @@ -895,6

Re: pgbench - add \if support

2017-12-14 Thread Fabien COELHO
Mostly a rebase after zipfian function commit. 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: -

pgbench - add \if support

2017-11-25 Thread Fabien COELHO
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