Re: pgbench - allow backslash-continuations in custom scripts

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: pgbench - allow backslash-continuations in custom scripts
Дата
Msg-id 28460.1458586908@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: pgbench - allow backslash-continuations in custom scripts  (Robert Haas <robertmhaas@gmail.com>)
Ответы Re: pgbench - allow backslash-continuations in custom scripts  (Robert Haas <robertmhaas@gmail.com>)
Список pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes:
> On Sun, Mar 20, 2016 at 1:07 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> This solves the problem of allowing SQL commands in scripts to span
>> lines, ...

> Excellent.

>> but it doesn't do anything about backslash commands, which was
>> the original point according to the thread title ;-).

> Wait, was it really?  I'd been thinking it was mostly to continue
> queries, not metacommands, but maybe I missed the boat.

Nah, you're right, it was about continuing queries.  Still, we've had
complaints about the other thing too, and I think if we're going to
change anything here, we should change it all in the same release.

>> I can think of
>> two somewhat-independent changes we might want to make at this point,
>> since we're breaking exact script compatibility for 9.6 anyway:
>> 
>> * Allow multiple backslash commands on one line, eg
>> \set foo 5 \set bar 6
>> The main reason for that is that psql allows it, and one of the things
>> we're supposedly trying to do here is reduce the behavioral distance
>> between psql and pgbench parsing rules.

> This seems to me to be going in the wrong direction.

Um, why exactly?  That psql behavior is of really ancient standing, and
we have not had complaints about it.

>> * Allow backslash commands to span lines, probably by adopting the
>> rule that backslash immediately followed by newline is to be ignored
>> within a backslash command.  This would not be compatible with psql,
>> though, at least not unless we wanted to change psql too.

> This might have some point to it, though, if you want to say \set i
> <incredibly long expression not easily contained on a single line>

Shall I make a patch that allows backslash-newline to be handled this way
in both psql and pgbench backslash commands?  At least in psql, there
would be no backwards compatibility problem, since right now the case
just fails:

regression=# \set x y \
Invalid command \. Try \? for help.
        regards, tom lane



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: Request - repeat value of \pset title during \watch interations
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Re: PROPOSAL: make PostgreSQL sanitizers-friendly (and prevent information disclosure)