Re: psql \conninfo command (was: Patch: psql \whoami option)

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: David Christensen <david(at)endpoint(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Steve Singer <ssinger_pg(at)sympatico(dot)ca>, pgsql-hackers Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: psql \conninfo command (was: Patch: psql \whoami option)
Date: 2010-07-20 03:34:43
Message-ID: AANLkTinz81pWtP0mmA2apM8nQSzzFEegP8bkJCmAqFHM@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Jul 18, 2010 at 2:00 PM, David Christensen <david(at)endpoint(dot)com> wrote:
> Updated the commitfest entry with the patch, updated the title to reflect the actual name of the command, and marked as ready for committer.

I took a look at this patch. One problem is that it doesn't handle
the case where there is no database connection (for example, shut down
the database with pg_ctl, then do select 1, then do \conninfo). I've
fixed that in the attached version.

However, I'm also wondering about the output format. I feel like it
would make sense to use a format similar to what we do for \c, which
looks like this:

You are now connected to database "%s".

It prints out more parameters if they've changed. The longest
possible version is:

You are now connected to database "%s" on host "%s" at port "%s" as user "%s".

My suggestion is that we use the same format, except (1) always
include all the components, since that's the point; (2) don't include
the word "now"; and (3) if there is no host, then print "via local
socket" rather than on host...port.... So where the current patch
prints:

Connected to database: "rhaas", user: "rhaas", port: 5432 via local
domain socket

I would propose to print instead:

You are connected to database "rhaas" via local socket as user "rhaas".

If people strongly prefer the way the patch does it now, I don't think
it's horrible... but it seems like it would be nicer to be somewhat
consistent with the existing message. Thoughts?

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

Attachment Content-Type Size
psql-conninfo-v3.patch application/octet-stream 3.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2010-07-20 03:40:07 Re: Explicit psqlrc
Previous Message Robert Haas 2010-07-20 03:23:02 Re: [COMMITTERS] pgsql: pgindent run for 9.0, second run