Re: pgbench - allow backslash-continuations in custom scripts

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>, Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pgbench - allow backslash-continuations in custom scripts
Date: 2016-04-10 15:19:18
Message-ID: 20160410151918.GA803137@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David G. Johnston 2016-04-10 15:49:54 Re: Relax requirement for INTO with SELECT in pl/pgsql
Previous Message Tom Lane 2016-04-10 15:06:42 Re: pgsql: Add the "snapshot too old" feature