Re: psql - better support pipe line

Поиск
Список
Период
Сортировка
От Shulgin, Oleksandr
Тема Re: psql - better support pipe line
Дата
Msg-id CACACo5TwPz0wO3du0SqmyXq5givCVNQh3-Ld4mJCs8WTZQ3_uA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: psql - better support pipe line  (Jim Nasby <Jim.Nasby@BlueTreble.com>)
Ответы Re: psql - better support pipe line  (Jim Nasby <Jim.Nasby@BlueTreble.com>)
Список pgsql-hackers
On Fri, Aug 28, 2015 at 3:29 AM, Jim Nasby <Jim.Nasby@bluetreble.com> wrote:
On 8/27/15 8:37 AM, Pavel Stehule wrote:

    I don't think we can detect and remove the default values from this
    output in a reliable way?


This is pretty difficult - any parameter can be important, and hard to
identify default values on client side without connect to server side. I
don't see any other way, than hold bitmap for identification entered
values and default values from the input.

That would be nice, but probably not that big a deal.

What I think would be more useful is a way to exclude the password if you didn't need it.

Good point, and maybe even exclude it by default and provide only if asked for that explicitly.
 
It occurs to me the most flexible thing that could be done here would be providing a libpq function that spits out JSON connection parameters and have psql turn that into a variable. It would be easy to feed that to a SQL statement and do whatever you want with it at that point, including format it to a connection URI.

Hm... but that would mean that suddenly psql would need JSON parsing capabilities and URI escaping code would have to be moved there too?  So every client that links to libpq and wants to use this feature going as far as reconstructing an URI would need both of the capabilities.

Why instead of JSON not spit conninfo format, with proper escaping?  That could be a separate library call, e.g. PGgetConnectionString() and a separate backslash command: \conninfo

--
Alex

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

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: patch: version_stamp.pl: Add Git commit info to version if 'git' is specified
Следующее
От: Fabien COELHO
Дата:
Сообщение: Re: patch: version_stamp.pl: Add Git commit info to version if 'git' is specified