|From:||Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>|
|Cc:||tgl(at)sss(dot)pgh(dot)pa(dot)us, andres(at)anarazel(dot)de, hlinnaka(at)iki(dot)fi, josh(at)agliodbs(dot)com, pgsql-hackers(at)postgresql(dot)org|
|Subject:||Re: pgbench - allow backslash-continuations in custom scripts|
|Views:||Raw Message | Whole Thread | Download mbox | Resend email|
> If you feel that this feature only deserve a lexer solution, then the
> patch should be "returned with feedback".
It's unfortunate to abandon this idea so I tried this and made it
run with psql's parser. I think it works as expected.
The attached files are as follwoing.
A patch to modify psql so that psqlscan can be shared with other modules.
A patch to use psqlscan in pgbench.
A sample custom script including multilne statement and line comment
I can't judge wheter this is a new version of Febien's patch
following Tom's suggestion or brand-new one. Anyway I'd like to
post on this thread.
At Fri, 17 Jul 2015 21:26:44 +0200 (CEST), Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr> wrote in <alpine(dot)DEB(dot)2(dot)10(dot)1507172113080(dot)31314(at)sto>
> > 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:-)
The patch set consists of two parts.
The first modifies psqlscan.l to work in pgbench. Almost along on
- Eliminate direct reading of pset and store them into
PsqlScanState in psql_scan_setup.
- variables, common, settings and prompt in pgbench are the
shrinked version from that of psql.
The second part modifies pgbench to use the modified version of
psqlscan.l. As the result,
- Multiline SQLs (not backslash continuation) in custom script is
allowed. (also for builtins but it's no use).
- backslash commands is handled as the same as before: multiline
is not allowed.
A sample script is also attached.
I don't have idea how to deal with the copy of psqlscan.[lh] from
psql. Currently they are simply the dead copies of those of psql.
- Modifying psqlscan in psql requires consideration on how it is
used in pgbench.
- They are rather small but common, variables, prompt are
essentially needeless files..
NTT Open Source Software Center
|Next Message||Amit Kapila||2015-07-24 04:26:25||Re: RFC: replace pg_stat_activity.waiting with something more descriptive|
|Previous Message||Alvaro Herrera||2015-07-24 01:14:04||Re: BRIN index and aborted transaction|