Re: pgbench - allow backslash-continuations in custom scripts

From: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, Josh Berkus <josh(at)agliodbs(dot)com>, PostgreSQL Developers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pgbench - allow backslash-continuations in custom scripts
Date: 2015-07-03 12:09:01
Message-ID: alpine.DEB.2.10.1507031342240.16176@sto
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ashutosh Bapat 2015-07-03 12:29:48 Re: [HACKERS] GSoC 2015 proposal: Improve the performance of “ALTER TABLE .. SET LOGGED / UNLOGGED” statement
Previous Message Amit Kapila 2015-07-03 12:05:43 Re: Parallel Seq Scan