Skip site navigation (1) Skip section navigation (2)

Re: Patch: psql \whoami option

From: David Christensen <david(at)endpoint(dot)com>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: Josh Berkus <josh(at)agliodbs(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Patch: psql \whoami option
Date: 2010-01-27 14:01:04
Message-ID: 56DCD6FB-6173-4DBB-93B6-AE10DDC90D97@endpoint.com (view raw or flat)
Thread:
Lists: pgsql-hackers
On Jan 27, 2010, at 4:01 AM, Magnus Hagander wrote:

> 2010/1/27 Josh Berkus <josh(at)agliodbs(dot)com>:
>> On 1/26/10 3:24 PM, David Christensen wrote:
>>> -hackers,
>>>
>>> In the spirit of small, but hopefully useful interface improvement
>>> patches, enclosed for your review is a patch for providing psql  
>>> with a
>>> \whoami command (maybe a better name is \conninfo or similar).  Its
>>> purpose is to print information about the current connection, by  
>>> default
>>> in a human-readable format.  There is also an optional format  
>>> parameter
>>> which currently accepts 'dsn' as an option to output the current
>>> connection information as a DSN.
>
> On a first note, it seems like the check for the parameter "dsn" isn't
> "complete". Without testing it, it looks like it would be possible to
> run "\whoami foobar", which should give an error.

Yeah, I debated that; right now, it just ignores any output it doesn't  
know about and spits out the human-readable format.

>> oooh, I could really use this.  +1 to put it in 9.1-first CF.
>>
>> however, \conninfo is probably the better name.  And what about a
>
> +1 on that name.

That makes at least three, including me. :-)

>> postgresql function version for non-psql connections?
>
> How could that function possibly know what the connection looks like
> from the client side? Think NAT, think proxies, think connection
> poolers.

Yes, this doesn't seem to be a feasible thing to detect in all (many?)  
cases.

Regards,

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





In response to

Responses

pgsql-hackers by date

Next:From: Pavel StehuleDate: 2010-01-27 14:05:52
Subject: Re: C function accepting/returning cstring vs. text
Previous:From: Martijn van OosterhoutDate: 2010-01-27 13:44:02
Subject: Re: C function accepting/returning cstring vs. text

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group