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

From Tom Lane
Subject Re: [COMMITTERS] pgsql: Add \conninfo command to psql, to show current connection info.
Date
Msg-id 24071.1280858690@sss.pgh.pa.us
Whole thread Raw
In response to Re: [COMMITTERS] pgsql: Add \conninfo command to psql, to show current connection info.  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
List pgsql-hackers
"Kevin Grittner" <Kevin.Grittner@wicourts.gov> writes:
> Tom Lane <tgl@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


pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: review: xml_is_well_formed
Next
From: Robert Haas
Date:
Subject: Re: [COMMITTERS] pgsql: Add \conninfo command to psql, to show current connection info.