Re: psql - better support pipe line

From: "Shulgin, Oleksandr" <oleksandr(dot)shulgin(at)zalando(dot)de>
To: Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>
Cc: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: psql - better support pipe line
Date: 2015-08-28 08:58:14
Message-ID: CACACo5TwPz0wO3du0SqmyXq5givCVNQh3-Ld4mJCs8WTZQ3_uA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Aug 28, 2015 at 3:29 AM, Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fabien COELHO 2015-08-28 09:17:31 Re: patch: version_stamp.pl: Add Git commit info to version if 'git' is specified
Previous Message Andres Freund 2015-08-28 08:44:03 Re: patch: version_stamp.pl: Add Git commit info to version if 'git' is specified