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

From Tom Lane
Subject Re: pgbench - allow backslash-continuations in custom scripts
Date
Msg-id 6759.1458493669@sss.pgh.pa.us
Whole thread Raw
In response to Re: pgbench - allow backslash-continuations in custom scripts  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: pgbench - allow backslash-continuations in custom scripts  ("David G. Johnston" <david.g.johnston@gmail.com>)
Re: pgbench - allow backslash-continuations in custom scripts  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes:
> On Fri, Mar 18, 2016 at 10:02 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> This is mostly a flex/bison hack, isn't it?  If you like I'll take it.

> I would be delighted if you would.

I've committed changes equivalent to Horiguchi-san's 0001 and 0002
patches, though rather different in detail.  I concur with the upthread
opinion that 0003 doesn't seem really necessary.

This solves the problem of allowing SQL commands in scripts to span
lines, but it doesn't do anything about backslash commands, which was
the original point according to the thread title ;-).  I can think of
two somewhat-independent changes we might want to make at this point,
since we're breaking exact script compatibility for 9.6 anyway:

* Allow multiple backslash commands on one line, eg\set foo 5 \set bar 6
The main reason for that is that psql allows it, and one of the things
we're supposedly trying to do here is reduce the behavioral distance
between psql and pgbench parsing rules.

* Allow backslash commands to span lines, probably by adopting the
rule that backslash immediately followed by newline is to be ignored
within a backslash command.  This would not be compatible with psql,
though, at least not unless we wanted to change psql too.

I don't have strong feelings about either.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: PATCH: index-only scans with partial indexes
Next
From: "David G. Johnston"
Date:
Subject: Re: pgbench - allow backslash-continuations in custom scripts