Re: Allowing line-continuation in pgbench custom scripts

From: Amit Langote <amitlangote09(at)gmail(dot)com>
To: Josh Berkus <josh(at)agliodbs(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Allowing line-continuation in pgbench custom scripts
Date: 2014-05-27 00:52:32
Message-ID: CA+HiwqHgWrFYuLBZMimRdzdmU8ViBEq+h+1_trp=Mx97B9q7gQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, May 27, 2014 at 6:19 AM, Josh Berkus <josh(at)agliodbs(dot)com> wrote:
> On 05/26/2014 08:52 AM, Tom Lane wrote:
>> Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> writes:
>>> Amit Langote wrote:
>>>> On Mon, May 26, 2014 at 10:59 PM, Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
>>>>> IMO it's better if we can write SQL in multiples line *without* a tailing
>>>>> escape character, like psql's input file.
>>
>>>> Yeah, that would be much cleaner.
>>
>>> But that would require duplicating the lexing stuff to determine where
>>> quotes are and where commands end. There are already some cases where
>>> pgbench itself is the bottleneck; adding a lexing step would be more
>>> expensive, no? Whereas simply detecting line continuations would be
>>> cheaper.
>>
>> Well, we only parse the script file(s) once at run start, and that time
>> isn't included in the TPS timing, so I don't think performance is really
>> an issue here. But yeah, the amount of code that would have to be
>> duplicated out of psql is pretty daunting --- it'd be a maintenance
>> nightmare, for what seems like not a lot of gain. There would also
>> be a compatibility issue if we went this way, because existing scripts
>> that haven't bothered with semicolon line terminators would break.
>
> What if we make using semicolons or not a config option in the file? i.e.:
>
> \multiline
>
>

And perhaps make 'off' the default if I get it correctly?

It would apply only to the SQL commands though, no?

--
Amit

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2014-05-27 00:58:55 Extending MSVC scripts to support --with-extra-version
Previous Message Tom Lane 2014-05-26 23:24:20 Re: [PATCH] Replacement for OSSP-UUID for Linux and BSD