From: | Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr> |
---|---|
To: | Christoph Berg <myon(at)debian(dot)org> |
Cc: | PostgreSQL Developers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: pgbench - allow backslash continuations in \set expressions |
Date: | 2016-10-03 11:58:04 |
Message-ID: | alpine.DEB.2.20.1610031259400.19411@lancre |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hello Christoph,
>> Attached patch does what is described in the title, hopefully. Continuations
>> in other pgbench backslash-commands should be dealt with elsewhere...
>
> Would (a similar version of) that patch also apply to .psqlrc?
Pgbench has its own lexer & parser for \set expressions, so the
continuation is handled there.
> I "\set" a bunch of lengthy SQL commands in there, e.g.
I agree that this looks like a desirable feature, however I would tend to
see that as material for another independent patch.
I think that .pgsqrc is really just a "psql" script so the handling would
be somewhere there... I'll have a look.
> \set config 'SELECT name, current_setting(name), CASE source WHEN
> $$configuration file$$ THEN sourcefile||$$:$$||sourceline ELSE source
> END FROM pg_settings WHERE source <> $$default$$;'
Hmmm. I'm not sure how this is parsed. If this is considered a string
'...', then maybe \set should wait for the end of the string instead of
the end of the line, i.e. no continuation would be needed...
\set config '
SELECT name, ...
CASE ... END
FROM pg_settings
WHERE ...;'
> Being able to split that over several lines would greatly improve
> maintainability. (Though I do realize this would also require a notion
> for splitting/continuing strings.)
Yep. I'm not sure of the actual feature which is needed.
--
Fabien.
From | Date | Subject | |
---|---|---|---|
Next Message | Anastasia Lubennikova | 2016-10-03 12:29:38 | Re: WIP: Covering + unique indexes. |
Previous Message | maxim.boguk | 2016-10-03 11:53:22 | BUG #14350: VIEW with INSTEAD OF INSERT TRIGGER and COPY. Missing feature or working as designed. |