Re: [HACKERS] [COMMITTERS] pgsql: Add \conninfo command to psql, to show current connection info.

2010-08-03 Thread Tom Lane
rh...@postgresql.org (Robert Haas) writes:
 Add \conninfo command to psql, to show current connection info.
 David Christensen. Reviewed by Steve Singer.  Some further changes by me.

Looking at the output from this command:

regression=# \conninfo 
You are connected to database regression via local socket in /tmp at port 
5432 as user postgres.

This seems a bit awkwardly phrased.  I think it would read better if the
ordering was changed to

You are connected to database regression as user postgres via local socket 
in /tmp at port 5432.

I can't put my finger on the reason why the current ordering seems like
awkward English, but I can give a couple of concrete arguments for
changing it:

1. This way would match the argument ordering for \connect,
which in case you've forgotten is dbname user host port.

2. At least to me, this seems closer to the relative importance of the
items.

Comments, objections?

regards, tom lane

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] [COMMITTERS] pgsql: Add \conninfo command to psql, to show current connection info.

2010-08-03 Thread Kevin Grittner
Tom Lane t...@sss.pgh.pa.us wrote:
 
 You are connected to database regression as user postgres
 via local socket in /tmp at port 5432.
 
+1
 
-Kevin

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] [COMMITTERS] pgsql: Add \conninfo command to psql, to show current connection info.

2010-08-03 Thread Tom Lane
Kevin Grittner kevin.gritt...@wicourts.gov writes:
 Tom Lane t...@sss.pgh.pa.us wrote:
 You are connected to database regression as user postgres
 via local socket in /tmp at port 5432.
 
 +1

Looking at the code, I notice another problem, which is that it's a
rather egregious violation of the rule against assembling messages
out of small phrases that would have to be translated separately.
I realize that this is a pre-existing problem in \connect and the
\conninfo patch just copied it, but that doesn't make it OK.

The problem in \connect is that somebody made an arbitrary decision to
print only the parameters that changed, which they weren't even too
consistent about since the database name is always printed.  Maintaining
that behavior exactly would require quite a large number of variant
messages.  What I suggest we do in \connect is always print the database
and user names, plus print all of the addressing info if any of it
changed.  This would mean three translatable messages there:

You are now connected to database %s as user %s.
You are now connected to database %s as user %s on host %s at port %s.
You are now connected to database %s as user %s via local socket in %s at 
port %s.

while \conninfo would have two translatable messages corresponding
to the last two cases.

BTW, the word local seems to be useless extra verbiage; any
objections to making it just read via socket in?

regards, tom lane

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers