Re: pgbench - allow backslash-continuations in custom scripts

From: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
To: coelho(at)cri(dot)ensmp(dot)fr
Cc: hlinnaka(at)iki(dot)fi, pgsql-hackers(at)postgresql(dot)org
Subject: Re: pgbench - allow backslash-continuations in custom scripts
Date: 2015-08-19 00:13:24
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi, all.

> > 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.
> Sure. The feature *I* initially wanted was to have multi-line
> meta-commands. For this feature ISTM that continuations are, alas, the
> solution.
> >> 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've created an entry for the next commitfest, and put the status to
> "waiting on author".
> > 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.
> Good!

Hmm. psqlscan.l handles multistatement naturally.
I worked on that and the attached patche set does,

- backslash continuation for pgbench metacommands.

set variable \
<some value>

- SQL statement natural continuation lines.

FROM :bar;

- SQL multi-statement.


The work to be left is eliminating double-format of Command


Kyotaro Horiguchi
NTT Open Source Software Center

Attachment Content-Type Size
0001-Prepare-for-share-psqlscan-with-pgbench.patch text/x-patch 8.6 KB
0002-Make-use-of-psqlscan-for-parsing-of-custom-script.patch text/x-patch 18.9 KB
0003-Change-MSVC-Build-script.patch text/x-patch 1.2 KB

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Kouhei Kaigai 2015-08-19 00:23:14 Re: Bug? ExecChooseHashTableSize() got assertion failed with crazy number of rows
Previous Message David Rowley 2015-08-19 00:00:13 Re: Bug? ExecChooseHashTableSize() got assertion failed with crazy number of rows