Re: pgbench - allow backslash-continuations in custom scripts

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>, coelho(at)cri(dot)ensmp(dot)fr
Cc: tgl(at)sss(dot)pgh(dot)pa(dot)us, andres(at)anarazel(dot)de, josh(at)agliodbs(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: pgbench - allow backslash-continuations in custom scripts
Date: 2015-08-05 20:44:55
Message-ID: 55C275C7.8010402@iki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)cri(dot)ensmp(dot)fr> wrote in <alpine(dot)DEB(dot)2(dot)10(dot)1507240731050(dot)12839(at)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2015-08-05 20:59:31 Re: raw output from copy
Previous Message Alvaro Herrera 2015-08-05 19:54:43 Re: brin index vacuum versus transaction snapshots