Re: pgbench - allow backslash-continuations in custom scripts

From: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Andres Freund <andres(at)anarazel(dot)de>, 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-17 19:26:44
Message-ID: alpine.DEB.2.10.1507172113080.31314@sto
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hello Tom,

>> (although actually, why wouldn't we want to just implement variable
>> substitution exactly like it is in psql?
> Pgbench variable substitution is performed when the script is run, not while
> the file is being processed for being split, which is when a lexer would be
> used. The situation is not the same with psql. The most it could do would be
> to keep track of what substitution are done in queries.
>> So this is looking *eminently* doable.
> Possibly. How much more effort would be involved compared to the quick patch
> I did, I wonder:-)

I had a quick look at the code, and although it seems doable to hack the
psql lexer for pgbench benefit, I do not think it is a good idea:

- improving pgbench scripts is really a small feature which requires
a light weight approach in my opinion. There is no real benefit
of having a lexer solution which can handle contrived cases, because
they would be contrived cases and not the kind of tests really written
by pgbench users.

- the solution would probably be fragile to changes in psql, or
could prevent such changes because of the pgbench dependency,
and this does not look desirable.

- it would involve much more time than I'm ready to give on such a
small feature.

So the current patch, or possibly variants of this patch to fix issues
that may be raised, is what I'm ready to put forward on this.

If you feel that this feature only deserve a lexer solution, then the
patch should be "returned with feedback".


In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Corey Huinker 2015-07-17 22:32:45 Re: dblink: add polymorphic functions.
Previous Message Andrew Gierth 2015-07-17 18:57:22 Re: Grouping Sets: Fix unrecognized node type bug