Re: Allowing line-continuation in pgbench custom scripts

From: Christoph Berg <cb(at)df7cb(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Amit Langote <amitlangote09(at)gmail(dot)com>, Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Allowing line-continuation in pgbench custom scripts
Date: 2014-05-26 21:29:07
Message-ID: 20140526212907.GA24735@msgid.df7cb.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Re: Tom Lane 2014-05-26 <26629(dot)1401119523(at)sss(dot)pgh(dot)pa(dot)us>
> >> Yeah, that would be much cleaner.
>
> > But that would require duplicating the lexing stuff to determine where
> > quotes are and where commands end. There are already some cases where
> > pgbench itself is the bottleneck; adding a lexing step would be more
> > expensive, no? Whereas simply detecting line continuations would be
> > cheaper.
>
> Well, we only parse the script file(s) once at run start, and that time
> isn't included in the TPS timing, so I don't think performance is really
> an issue here. But yeah, the amount of code that would have to be
> duplicated out of psql is pretty daunting --- it'd be a maintenance
> nightmare, for what seems like not a lot of gain. There would also
> be a compatibility issue if we went this way, because existing scripts
> that haven't bothered with semicolon line terminators would break.

Fwiw, I would love to have some \ line continuation thing also for
.psqlrc. I have some dozen \set in there containing queries for
looking into stats/locks/whatever I can invoke just typing e.g.
:user_tables, and these are pretty hard to edit as they are squeezed
on one line.

I agree that putting an SQL parser into the backslash command parser
is overkill, but there's hardly a chance backslashes at the end of a
backslash command line would break anything, except for meeting what
most people would expect.

Christoph
--
cb(at)df7cb(dot)de | http://www.df7cb.de/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Christoph Berg 2014-05-26 22:00:26 Re: [PATCH] Replacement for OSSP-UUID for Linux and BSD
Previous Message Josh Berkus 2014-05-26 21:19:05 Re: Allowing line-continuation in pgbench custom scripts