Re: pgbench - allow backslash continuations in \set expressions

From: Rafia Sabih <rafia(dot)sabih(at)enterprisedb(dot)com>
To: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
Cc: PostgreSQL Developers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pgbench - allow backslash continuations in \set expressions
Date: 2016-11-01 11:44:41
Message-ID: CAOGQiiOhUwJcoa0zzO2NstAVtV7_EQno0LRBNC6zF7DT6j-LtQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Well with this new approach, the example you gave previously for better
readability:

> \set bid
> CASE WHEN random(0, 99) < 85
> THEN :tbid
> ELSE :abid + (:abid >= :tbid)
> END

will give error at the first line. In general, this new approach is likely
to create confusions in such cases. As an end-user one needs to be real
careful to check what portions have to split between lines. Keeping this in
mind, I'd prefer the previous approach.

On Tue, Nov 1, 2016 at 4:23 PM, Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr> wrote:

>
> Attached patch does what is described in the title, hopefully.
>> Continuations in other pgbench backslash-commands should be dealt with
>> elsewhere...
>>
>> Also attached is a small test script.
>>
>
> Here is another approach, with "infered" continuations: no backslash is
> needed, the parsing is pursued if the last token of the line cannot end an
> expression (eg an operator) or if there is an unclosed parenthesis.
>
> I think that backslashes are less surprising for the classically minded
> user, but this one is more fun:-) Also, this version changes a little more
> the scanner because on each token the next state (continued or not) must be
> decided.
>
> --
> Fabien.
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>
>

--
Regards,
Rafia Sabih
EnterpriseDB: http://www.enterprisedb.com/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Etsuro Fujita 2016-11-01 12:01:57 Re: Push down more full joins in postgres_fdw
Previous Message Kyotaro HORIGUCHI 2016-11-01 11:31:03 Re: Fix checkpoint skip logic on idle systems by tracking LSN progress