Re: [PATCH] Connection time for \conninfo

From: Stephen Frost <sfrost(at)snowman(dot)net>
To: David Steele <david(at)pgmasters(dot)net>
Cc: Rodrigo Ramírez Norambuena <decipher(dot)hk(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Michael Paquier <michael(at)paquier(dot)xyz>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: [PATCH] Connection time for \conninfo
Date: 2020-03-10 17:38:01
Message-ID: 20200310173801.GI3195@tamriel.snowman.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Greetings,

* David Steele (david(at)pgmasters(dot)net) wrote:
> On 2/27/20 4:21 AM, Peter Eisentraut wrote:
> >My opinion is that this is not particularly useful and not appropriate to
> >piggy-back onto \conninfo.  Connection information including host, port,
> >database, user name is a well-established concept in PostgreSQL programs
> >and tools and it contains a delimited set of information. Knowing what
> >server and what database you are connected to also seems kind of
> >important.  Moreover, this is information that is under control of the
> >client, so it must be tracked on the client side.

I have to say that I disagree. Wishing to know when you connected to a
server is entirely reasonable and it's also rather clearly under control
of the client (though I don't entirely understand that argument in the
first place).

> >Knowing how long you've been connected on the other hand seems kind of
> >fundamentally unimportant.  If we add that, what's to stop us from adding
> >other statistics of minor interest such as how many commands you've run,
> >how many errors there were, etc.  The connection time is already
> >available, and perhaps we should indeed make it a bit easier to get, but
> >it doesn't need to be a psql command.

Of 'minor' interest, or not, if it's something you'd like to know then
it's pretty handy if there's a way to get that info. This also isn't
inventing a new psql command but rather adding on to one that's clearly
already a 'creature comfort' command as everything included could be
gotten at in other ways.

As for the comparison to other things of minor interest, we do give
users a way to get things like line number (%l in PROMPT), so including
something akin to that certainly doesn't seem out of the question.
Having a '%T' or something in the prompt for connected-at-time seems
like it could certainly be useful too.

Going a bit farther, I wonder if conninfo could be configurable as a
Prompt-like string, that seems like it'd be pretty neat.

Anyway, I don't anticipate having time to do anything with this patch
but I disagree that this is a "we don't want it" kind of thing, rather
we maybe want it, since someone cared enough to write a patch, but the
patch needs work and maybe we want it to look a bit different and be
better defined.

Thanks,

Stephen

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2020-03-10 17:38:41 Re: [PATCH] Use PKG_CHECK_MODULES to detect the libxml2 library
Previous Message Fujii Masao 2020-03-10 17:19:14 Re: pg_stat_progress_basebackup - progress reporting for pg_basebackup, in the server side