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

Search Discussions

  • Kevin Grittner at Aug 3, 2010 at 5:50 pm

    Tom Lane wrote:

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

    -Kevin
  • Tom Lane at Aug 3, 2010 at 6:07 pm

    "Kevin Grittner" <Kevin.Grittner@wicourts.gov> writes:
    Tom Lane 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
  • Robert Haas at Aug 3, 2010 at 6:49 pm

    On Tue, Aug 3, 2010 at 1:46 PM, Tom Lane wrote:
    1. This way would match the argument ordering for \connect,
    which in case you've forgotten is dbname user host port.
    I noticed that discrepancy when reviewing, but felt it was a problem
    for another day. Today is fine, though. :-)

    --
    Robert Haas
    EnterpriseDB: http://www.enterprisedb.com
    The Enterprise Postgres Company

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppgsql-hackers @
categoriespostgresql
postedAug 3, '10 at 5:46p
activeAug 3, '10 at 6:49p
posts4
users3
websitepostgresql.org...
irc#postgresql

People

Translate

site design / logo © 2022 Grokbase