Re: [HACKERS] pgbench - allow backslash continuations in \setexpressions - Mailing list pgsql-hackers

From Fabien COELHO
Subject Re: [HACKERS] pgbench - allow backslash continuations in \setexpressions
Date
Msg-id alpine.DEB.2.20.1701111257010.11499@lancre
Whole thread Raw
In response to Re: [HACKERS] pgbench - allow backslash continuations in \set expressions  (Rafia Sabih <rafia.sabih@enterprisedb.com>)
Responses Re: [HACKERS] pgbench - allow backslash continuations in \set expressions
List pgsql-hackers
Hello,

>> The attached patch adds backslash-return (well newline really) continuations
>> to all pgbench backslash-commands.
>>
>> The attached test uses continuations on all such commands (sleep set
>> setshell and shell).
>>
>> I think that adding continuations to psql should be a distinct patch.

> The patch does not apply on the latest head, I guess this requires 
> rebasing since yours is posted in December.

Strange. Here is a new version and a test for all known backslash-commands 
in pgbench.

   sh> git br test master
   sh> git apply ~/pgbench-continuation-3.patch
   # ok
   sh> git diff
   # ok
   sh> cd src/bin/pgbench
   sh> make
   sh> ./pgbench -t 1 -f SQL/cont.sql
   starting vacuum...end.
   debug(script=0,command=1): int 0
   debug(script=0,command=2): int 1
   debug(script=0,command=4): int 2
   3
   debug(script=0,command=8): int 4
   transaction type: SQL/cont.sql

> Again, it is giving trailing whitespace errors (as I reported for the 
> earlier version), plus it does not apply with git apply,

It does above with the attached version.

> hopefully that would be fixed once rebased. Other than that, I observed 
> that if after backslash space is there, then the command fails.

Yes, this is expected.

> I think it should be something like if after backslash some spaces are 
> there, followed by end-of-line then it should ignore these spaces and 
> read next line, atleast with this new meaning of backslash.

Hmmm. This is not the behavior of backslash continuation in bash or 
python, I do not think that this is desirable to have a different 
behavior.

> Otherwise, it should be mentioned in the docs that backslash should not 
> be followed by space.

I'm not sure. Doc says that continuation is "backslash-return", it cannot 
be more explicit. If it must say what it is not, where should it stop?

-- 
Fabien.
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Attachment

pgsql-hackers by date:

Previous
From: tushar
Date:
Subject: Re: [HACKERS] Parallel bitmap heap scan
Next
From: Etsuro Fujita
Date:
Subject: Re: [HACKERS] Push down more full joins in postgres_fdw