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.


--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to