Re: pgbench - allow backslash-continuations in custom scripts - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: pgbench - allow backslash-continuations in custom scripts
Date
Msg-id 55C275C7.8010402@iki.fi
Whole thread Raw
In response to Re: pgbench - allow backslash-continuations in custom scripts  (Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>)
Responses Re: pgbench - allow backslash-continuations in custom scripts  (Fabien COELHO <coelho@cri.ensmp.fr>)
List pgsql-hackers
On 07/24/2015 11:36 AM, Kyotaro HORIGUCHI wrote:
> At Fri, 24 Jul 2015 07:39:16 +0200 (CEST), Fabien COELHO <coelho@cri.ensmp.fr> wrote in
<alpine.DEB.2.10.1507240731050.12839@sto>
>>> - backslash commands is handled as the same as before: multiline
>>>   is not allowed.
>>
>> Hmm... that is really the feature I wanted to add initially, too bad
>> it is the dropped one:-)
>
> Ouch. The story has been derailed somewhere.
>
> Since SQL statments could be multilined without particluar
> marker, we cannot implement multilined backslash commands in the
> same way..

I don't think we actually want backslash-continuations. The feature we 
want is "allow SQL statements span multiple lines", and using the psql 
lexer solves that. We don't need the backslash-continuations when we 
have that.

On 07/25/2015 05:53 PM, Fabien COELHO wrote:
>>>> I don't have idea how to deal with the copy of psqlscan.[lh] from
>>>> psql. Currently they are simply the dead copies of those of psql.
>>>
>>> I think that there should be no copies, but it should use relative
>>> symbolic links so that the files are kept synchronized.
>>
>> Yeah, I think so but symlinks could harm on git and Windows.
>> The another way would be make copies it from psql directory. They live
>> next door to each other.
>
> Indeed there are plenty of links already which are generated by makefiles
> (see src/bin/pg_xlogdump/*), and probably a copy is made on windows. There
> should no file duplication within the source tree.

Yeah, following the example of pg_xlogdump and others is the way to go.

Docs need updating, and there's probably some cleanup to do before this 
is ready for committing, but overall I think this is definitely the 
right direction.

I complained upthread that this makes it impossible to use 
"multi-statements" in pgbench, as they would be split into separate 
statements, but looking at psqlscan.l there is actually a syntax for 
that in psql already. You escape the semicolon as \;, e.g. "SELECT 1 \; 
SELECT 2;", and then both queries will be sent to the server as one. So 
even that's OK.

- Heikki



pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: brin index vacuum versus transaction snapshots
Next
From: Heikki Linnakangas
Date:
Subject: Re: raw output from copy