pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@postgresql.org
Subject: pgsql: SQL commands in pgbench scripts are now ended by semicolons, not
Date: Sun, 20 Mar 2016 16:59:11 +0000
Message-ID: <E1ahgh5-0001sl-Mb@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

SQL commands in pgbench scripts are now ended by semicolons, not newlines.

To allow multiline SQL commands in scripts, adopt the same rules psql uses
to decide what is the end of a SQL command, to wit, an unquoted semicolon
not encased in parentheses.  Do this by importing the same flex lexer that
psql uses, since coping with stuff like dollar-quoted literals is hard to
get right without going the full nine yards.

This makes use of the infrastructure added in commit 0ea9efbe9ec1bf07 to
support independently-written flex lexers scanning the same PsqlScanState
input-buffer data structure.  Since that infrastructure isn't very
friendly to ad-hoc parsing code such as strtok(), improve exprscan.l
so that it can parse either whitespace-separated words or expression
tokens, on demand, and rewrite pgbench.c's backslash-command parsing
code to always use the lexer to fetch tokens.

It's still the case that pgbench backslash commands extend to the end
of the line, no more and no less.  That could be changed in a fairly
localized way now, and there was some interest in doing so, but it
seems like material for a separate patch.

In passing, make some marginal cleanups in syntax error reporting,
const-ify a few data structures that could use it, and run some of
this code through pgindent.

I can't tell whether the MSVC build scripts need to be taught explicitly
about the changes here or not, but the buildfarm will soon tell us.

Kyotaro Horiguchi and Tom Lane

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/68ab8e8ba4a471d91b69f2f89782ba10a0fbef0c

Modified Files
--------------
doc/src/sgml/ref/pgbench.sgml |  43 ++-
src/bin/pgbench/Makefile      |  14 +-
src/bin/pgbench/exprparse.y   |  65 ++--
src/bin/pgbench/exprscan.l    | 320 ++++++++++++++----
src/bin/pgbench/pgbench.c     | 750 ++++++++++++++++++++++++------------------
src/bin/pgbench/pgbench.h     |  25 +-
6 files changed, 776 insertions(+), 441 deletions(-)


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


Message-ID: <E1ahgh5-0001sl-Mb@gemulon.postgresql.org>
Permalink:  ../E1ahgh5-0001sl-Mb@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1ahgh5-0001sl-Mb@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: SQL commands in pgbench scripts are now ended by semicolons, not
  In-Reply-To: <E1ahgh5-0001sl-Mb@gemulon.postgresql.org>
  References: <E1ahgh5-0001sl-Mb@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox