Re: pgbench - allow backslash-continuations in custom scripts

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: pgbench - allow backslash-continuations in custom scripts
Дата
Msg-id 20150703105441.GB3291@awork2.anarazel.de
обсуждение исходный текст
Ответ на Re: pgbench - allow backslash-continuations in custom scripts  (Heikki Linnakangas <hlinnaka@iki.fi>)
Ответы Re: pgbench - allow backslash-continuations in custom scripts  (Fabien COELHO <coelho@cri.ensmp.fr>)
Список pgsql-hackers
On 2015-07-03 13:50:02 +0300, Heikki Linnakangas wrote:
> As Tom pointed out, you need the full lexer to do this correctly. You can
> argue that something that handles the most common cases is enough, but
> realistically, by the time you've handled all the common cases correctly,
> you've just re-invented the lexer.

Yes.

> I think we should either bite the bullet and include the full SQL lexer in
> pgbench, or come up with some new syntax for marking the beginning and end
> of a statement.

I'm pretty clearly in favor of doing correct lexing. I think we should
generalize that and make it reusable. psql has it's own hacked up
version already, there seems little point in having variedly good copies
around.

> We could do something like bash here-documents or Postgres
> dollar-quoting, for example:
> 
> \set ...
> select 1234; -- A statement on a single line, no change here
> 
> -- Begin a multi-line statement
> \multi-line-statement END_TOKEN
> select *
>   from complicated;
> END_TOKEN

Not pretty imo. I could see including something esimpler, in addition to
the lexer, to allow sending multiple statements in one go.



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

Предыдущее
От: Heikki Linnakangas
Дата:
Сообщение: Re: pgbench - allow backslash-continuations in custom scripts
Следующее
От: Fabrízio de Royes Mello
Дата:
Сообщение: Re: [HACKERS] GSoC 2015 proposal: Improve the performance of “ALTER TABLE .. SET LOGGED / UNLOGGED” statement