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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
Cc: "David Christensen" <david(at)endpoint(dot)com>, "Robert Haas" <robertmhaas(at)gmail(dot)com>, pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [COMMITTERS] pgsql: Add \conninfo command to psql, to show current connection info.
Date: 2010-08-03 18:04:50
Message-ID: 24071.1280858690@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

"Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov> writes:
> Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2010-08-03 18:33:09 pgsql: Kibitzing on \conninfo patch: adjust the order of field output to
Previous Message Kevin Grittner 2010-08-03 17:50:23 Re: [COMMITTERS] pgsql: Add \conninfo command to psql, to show current connection info.

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2010-08-03 18:49:24 Re: [COMMITTERS] pgsql: Add \conninfo command to psql, to show current connection info.
Previous Message Pavel Stehule 2010-08-03 17:57:14 Re: review: xml_is_well_formed