Re: pgbench - allow backslash continuations in \set expressions

Поиск
Список
Период
Сортировка
От Fabien COELHO
Тема Re: pgbench - allow backslash continuations in \set expressions
Дата
Msg-id alpine.DEB.2.20.1610031259400.19411@lancre
обсуждение исходный текст
Ответ на Re: pgbench - allow backslash continuations in \set expressions  (Christoph Berg <myon@debian.org>)
Ответы Re: pgbench - allow backslash continuations in \set expressions  (Christoph Berg <myon@debian.org>)
Список 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.



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Peter Geoghegan
Дата:
Сообщение: Re: Tuplesort merge pre-reading
Следующее
От: Anastasia Lubennikova
Дата:
Сообщение: Re: WIP: Covering + unique indexes.