Re: psql \conninfo command (was: Patch: psql \whoami option)

From: David Christensen <david(at)endpoint(dot)com>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Steve Singer <ssinger_pg(at)sympatico(dot)ca>, pgsql-hackers Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: psql \conninfo command (was: Patch: psql \whoami option)
Date: 2010-07-22 02:09:15
Message-ID: 8F885444-E72E-4C96-ABF7-D27039EE7DE3@endpoint.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On Jul 21, 2010, at 8:48 PM, Fujii Masao wrote:

> On Wed, Jul 21, 2010 at 7:29 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
>> On Wed, Jul 21, 2010 at 1:07 AM, Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
>>> On Tue, Jul 20, 2010 at 11:14 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
>>>> OK, committed.
>>>
>>> When I specify the path of the directory for the Unix-domain socket
>>> as the host, \conninfo doesn't mention that this connection is based
>>> on the Unix-domain socket. Is this intentional?
>>>
>>> $ psql -h"/tmp" -c"\conninfo"
>>> You are connected to database "postgres" on host "/tmp" at port "5432"
>>> as user "postgres".
>>>
>>> I expected that something like
>>>
>>> You are connected to database "postgres" via local socket on
>>> "/tmp" at port "5432" as user "postgres".
>>
>> :-(
>>
>> No, I didn't realize the host field could be used that way. It's true
>> that you get a fairly similar message from \c, but that's not exactly
>> intuitive either.
>>
>> rhaas=# \c - - /tmp -
>> You are now connected to database "rhaas" on host "/tmp".
>
> OK. The attached patch makes \conninfo command emit the following
> message if the host begins with a slash:
>
> $ psql -h/tmp -c"\conninfo"
> You are connected to database "postgres" via local socket on
> "/tmp" at port "5432" as user "postgres".
>
> Similarly, it makes \c command emit the following message in that
> case:
>
> $ psql -hlocalhost -c"\c - - /tmp -"
> You are now connected to database "postgres" via local socket on "/tmp".

If we print the local socket when it's been explicitly set via the host= param, why not display the actual socket path in the general local socket case?

Also, while we're still tweaking this patch, I've had a couple requests for the SSL status of the connection as well; does this seem like a generally useful parameter to display as well?

Regards,

David
--
David Christensen
End Point Corporation
david(at)endpoint(dot)com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2010-07-22 02:51:10 Re: Synchronous replication
Previous Message Fujii Masao 2010-07-22 01:48:29 Re: psql \conninfo command (was: Patch: psql \whoami option)