From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Robert Haas <robertmhaas(at)gmail(dot)com> |
Cc: | 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-03-21 21:15:18 |
Message-ID: | 1596.1458594918@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
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.
However, since pgbench is already set up to slurp the entire file and
lex it in one go, it is just a trivial adjustment to the lexer rules in
that program. The only thing I found that made it complicated is that
syntax_error() had too simplistic an understanding of how to position
the error cursor usefully, so that needed a bit of work.
I think it'd be okay to commit this without fixing psql at the same time;
if you try it in psql you get an error, so on that side it's unimplemented
behavior rather than an actual incompatibility. Perhaps somebody will be
motivated to fix it later, but I'm not going to spend that kind of time
on it right now.
I've not written a docs update, but otherwise I think this is committable.
Comments?
regards, tom lane
Attachment | Content-Type | Size |
---|---|---|
pgbench-backslash-newline-in-meta-commands.patch | text/x-diff | 4.8 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2016-03-21 21:25:04 | Re: [GENERAL] Request - repeat value of \pset title during \watch interations |
Previous Message | Pavel Stehule | 2016-03-21 21:13:12 | Re: Relax requirement for INTO with SELECT in pl/pgsql |