Re: pgbench - allow backslash-continuations in custom scripts - Mailing list pgsql-hackers

From Fabien COELHO
Subject Re: pgbench - allow backslash-continuations in custom scripts
Date
Msg-id alpine.DEB.2.10.1507031342240.16176@sto
Whole thread Raw
In response to Re: pgbench - allow backslash-continuations in custom scripts  (Andres Freund <andres@anarazel.de>)
Responses Re: pgbench - allow backslash-continuations in custom scripts  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
> 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.

I must admit that I do not know how to share lexer rules but have 
different actions on them (psql vs sql parser vs ...), as the action code 
is intrinsically intertwined with expressions. Maybe some hack is 
possible. Having yet another SQL-lexer to maintain seems highly 
undesirable, especially just for pgbench.

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

Currently, probably
  SELECT 1; SELECT 1;

Does 2 statements in one go, but it is on one line.

May by allowing both continuations and ";" at the same time:
  -- two statements in one go  SELECT 1; \  SELECT 1;  -- next statement on it's own  SELECT    1;

Which could be reasonnably neat, and easy to implement.

-- 
Fabien.



pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: Parallel Seq Scan
Next
From: Ashutosh Bapat
Date:
Subject: Re: [HACKERS] GSoC 2015 proposal: Improve the performance of “ALTER TABLE .. SET LOGGED / UNLOGGED” statement