Re: Allowing line-continuation in pgbench custom scripts

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Amit Langote <amitlangote09(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Allowing line-continuation in pgbench custom scripts
Date: 2014-05-26 13:59:49
Message-ID: CAHGQGwGfywr87qU5FdwdO_9wRBZacNUgpg+F5w1tTWhMuutd8w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, May 26, 2014 at 6:50 PM, Amit Langote <amitlangote09(at)gmail(dot)com> wrote:
> Hi,
>
> In a custom pgbench script, it seems convenient to be able to split a
> really long query to span multiple lines using an escape character
> (bash-style). Attached adds that capability to read_line_from_file()
> in pgbench.c
>
> For example,
>
> BEGIN;
> \setrandom 1 16500000
> UPDATE table \
> SET col2 = (clock_timestamp() + '10s'::interval * random() * 1000), \
> col3 = (clock_timestamp() + '10s'::interval * sin(random() *
> (2*pi()) ) * 1000) \
> WHERE col1 = :id;
> COMMIT;
>
> instead of:
>
> BEGIN;
> \setrandom id 1 16500000
> UPDATE table SET col2 = (clock_timestamp() + '10s'::interval *
> random() * :id), col3 = (clock_timestamp() + '10s'::interval *
> sin(random() * (2*pi()) ) * 100000) WHERE col1 = :id;
> COMMIT;
>
> Thoughts?

IMO it's better if we can write SQL in multiples line *without* a tailing
escape character, like psql's input file.

Regards,

--
Fujii Masao

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2014-05-26 14:16:55 Re: Priority table or Cache table
Previous Message Michael Paquier 2014-05-26 12:50:42 Re: Re: popen and pclose redefinitions causing many warning in Windows build