Re: pgbench - allow backslash continuations in \set expressions

From: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Rafia Sabih <rafia(dot)sabih(at)enterprisedb(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL Developers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pgbench - allow backslash continuations in \set expressions
Date: 2016-11-30 23:04:43
Message-ID: alpine.DEB.2.20.1611302335520.20436@lancre
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Hello Tom,

> In short, I want to mark this RWF for today and ask for a version that
> applies globally to all backslash commands in psql and pgbench.

Hmmm.

The modus operandi of backslash command scanning is to switch to possibly
another scanner just after scanning the backslash command, so I did the
simple thing which is to handle this in the expression scanner. A simple
feature achieved with a simple code.

Factoring out the behavior means handling continuations from the master
scanner, probably by using some other intermediate buffer which is then
rescanned...

This implies that all backslash commands share some kind of minimal
lexical convention that \ followed by a (\r|\n|\r\n) is a continuation...

But then what if the backslash command accept quoted strings, should a
continuation still be a continuation inside quotes? If not, how do I know?
Are all currently existing backslash command compatible with a common set
of lexical convention? Or do some commands should accept backslash
continuations and others not, and have to be treated differently and
knowingly by the lexer?

There is also the issue of locating error messages if the continuation is
in another buffer, probably someone will complain.

Basically, many issues arise, all of them somehow solvable, but I'm afraid
with many more lines than my essentially one line patch:-)

I'm not sure such a simple feature deserves so much energy.

--
Fabien.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2016-11-30 23:38:21 Re: pgbench - allow backslash continuations in \set expressions
Previous Message Stephen Frost 2016-11-30 21:54:19 Re: Add support for restrictive RLS policies