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.