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

From Alvaro Herrera
Subject Re: pgbench - allow backslash-continuations in custom scripts
Date
Msg-id 20160410151918.GA803137@alvherre.pgsql
Whole thread Raw
In response to Re: pgbench - allow backslash-continuations in custom scripts  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Tom Lane wrote:
> So I looked into this, and found that persuading psql to let backslash
> commands cross line boundaries is a much bigger deal than just fixing the
> lexer.  The problem is that MainLoop would need to grow an understanding
> of having received only a partial backslash command and needing to go back
> to readline() for another line.  And probably HandleSlashCmds would need
> to be changed to stop parsing and back out without doing anything when it
> hits backslash-newline.  It's do-able no doubt, but it's not going to be a
> small and simple patch.

FWIW, I would love to see this in some future release: particularly for
\copy lines with large queries, the limitation that only single-line
input is accepted is very annoying -- much more so when the query comes
pasted from some other input, or when you have a file with a query and
just want to add a quick \copy prefix.

(Hmm, a much simpler alternative would be to allow \g-like syntax, i.e.
the query is already in the query buffer and the \copy line just
specifies the output file.  In fact, for queries in history this is much
more convenient than the current syntax ...)

-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: VS 2015 support in src/tools/msvc
Next
From: "David G. Johnston"
Date:
Subject: Re: Relax requirement for INTO with SELECT in pl/pgsql