Re: WIP patch for TODO Item: Add prompt escape to display the client and server versions

Lists: pgsql-hackers
From: "Dickson S(dot) Guedes" <listas(at)guedesoft(dot)net>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: WIP patch for TODO Item: Add prompt escape to display the client and server versions
Date: 2009-05-07 02:23:41
Message-ID: 1241663021.8647.11.camel@guedes-laptop
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

This is a WIP patch (for the TODO item in the subject) that I'm putting
in the Commit Fest queue for 8.5.

regards...
--
Dickson S. Guedes
mail/xmpp: guedes(at)guedesoft(dot)net - skype: guediz
http://guedesoft.net - http://www.postgresql.org.br

Attachment Content-Type Size
psql_escape_client_server_version.patch.bz2 application/x-bzip 1007 bytes

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-hackers(at)postgresql(dot)org
Cc: "Dickson S(dot) Guedes" <listas(at)guedesoft(dot)net>
Subject: Re: WIP patch for TODO Item: Add prompt escape to display the client and server versions
Date: 2009-05-07 07:11:09
Message-ID: 200905071011.10041.peter_e@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thursday 07 May 2009 05:23:41 Dickson S. Guedes wrote:
> This is a WIP patch (for the TODO item in the subject) that I'm putting
> in the Commit Fest queue for 8.5.

How about you just put the values in a variable and use the existing facility
to put those variables in the prompt?


From: "Dickson S(dot) Guedes" <listas(at)guedesoft(dot)net>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: WIP patch for TODO Item: Add prompt escape to display the client and server versions
Date: 2009-05-07 12:09:39
Message-ID: 1241698179.25272.16.camel@analise3.cresoltec.com.br
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Em Qui, 2009-05-07 às 10:11 +0300, Peter Eisentraut escreveu:
> On Thursday 07 May 2009 05:23:41 Dickson S. Guedes wrote:
> > This is a WIP patch (for the TODO item in the subject) that I'm putting
> > in the Commit Fest queue for 8.5.
>
> How about you just put the values in a variable and use the existing facility
> to put those variables in the prompt?

Change all "pset.version calculations" in "case 'V'" to something like
"case 'v'" is doing with PG_VERSION? Yes, could be better.

The specific code used to %V and %v in this patch was "inspired" in the
code in connection_warnings function in commands.c, so should this be
"refactored" too?

Thanks.

Dickson S. Guedes
mail/xmpp: guedes(at)guedesoft(dot)net - skype: guediz
http://guedesoft.net - http://planeta.postgresql.org.br


From: Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec>
To: "Dickson S(dot) Guedes" <listas(at)guedesoft(dot)net>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: WIP patch for TODO Item: Add prompt escape to display the client and server versions
Date: 2009-07-14 06:12:21
Message-ID: 3073cc9b0907132312s1c5a9e4eob968b94bf073ac79@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

2009/5/7 Dickson S. Guedes <listas(at)guedesoft(dot)net>:
> Em Qui, 2009-05-07 às 10:11 +0300, Peter Eisentraut escreveu:
>> On Thursday 07 May 2009 05:23:41 Dickson S. Guedes wrote:
>> > This is a WIP patch (for the TODO item in the subject) that I'm putting
>> > in the Commit Fest queue for 8.5.
>>
>> How about you just put the values in a variable and use the existing facility
>> to put those variables in the prompt?
>
> Change all "pset.version calculations" in "case 'V'" to something like
> "case 'v'" is doing with PG_VERSION? Yes, could be better.
>

are we waiting for a new version of this one?

--
Atentamente,
Jaime Casanova
Soporte y capacitación de PostgreSQL
Asesoría y desarrollo de sistemas
Guayaquil - Ecuador
Cel. +59387171157


From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-hackers(at)postgresql(dot)org
Cc: Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec>, "Dickson S(dot) Guedes" <listas(at)guedesoft(dot)net>
Subject: Re: WIP patch for TODO Item: Add prompt escape to display the client and server versions
Date: 2009-07-14 07:37:52
Message-ID: 200907141037.52308.peter_e@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tuesday 14 July 2009 09:12:21 Jaime Casanova wrote:
> 2009/5/7 Dickson S. Guedes <listas(at)guedesoft(dot)net>:
> > Em Qui, 2009-05-07 às 10:11 +0300, Peter Eisentraut escreveu:
> >> On Thursday 07 May 2009 05:23:41 Dickson S. Guedes wrote:
> >> > This is a WIP patch (for the TODO item in the subject) that I'm
> >> > putting in the Commit Fest queue for 8.5.
> >>
> >> How about you just put the values in a variable and use the existing
> >> facility to put those variables in the prompt?
> >
> > Change all "pset.version calculations" in "case 'V'" to something like
> > "case 'v'" is doing with PG_VERSION? Yes, could be better.
>
> are we waiting for a new version of this one?

At first glance it looked OK to me.


From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-hackers(at)postgresql(dot)org
Cc: "Dickson S(dot) Guedes" <listas(at)guedesoft(dot)net>
Subject: Re: WIP patch for TODO Item: Add prompt escape to display the client and server versions
Date: 2009-07-16 20:40:45
Message-ID: 200907162341.13978.peter_e@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thursday 07 May 2009 05:23:41 Dickson S. Guedes wrote:
> This is a WIP patch (for the TODO item in the subject) that I'm putting
> in the Commit Fest queue for 8.5.

The problem I'm seeing with this is that currently it resolves

%v (client) = 8.5devel
%V (server) = 8.5.0

Besides being inconsistent, it's also pretty misleading. I'd imagine a
significant use of this feature would be to know that one is connected to,
say, a beta version.

More generally, does anyone actually need this feature? psql complains loudly
enough if the version numbers are not the right ones. I don't know why this
would need to be repeated in the prompt.


From: "Dickson S(dot) Guedes" <listas(at)guedesoft(dot)net>
To: "Peter Eisentraut" <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: WIP patch for TODO Item: Add prompt escape to display the client and server versions
Date: 2009-07-17 20:24:16
Message-ID: op.uw8ayqptij9ntq@analise3.cresoltec.com.br
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Em Thu, 16 Jul 2009 17:40:45 -0300, Peter Eisentraut <peter_e(at)gmx(dot)net>
escreveu:

> On Thursday 07 May 2009 05:23:41 Dickson S. Guedes wrote:
>> This is a WIP patch (for the TODO item in the subject) that I'm putting
>> in the Commit Fest queue for 8.5.

> More generally, does anyone actually need this feature? psql complains
> loudly enough if the version numbers are not the right ones. I don't
> know why this would need to be repeated in the prompt.

An use case that i can figure out is an user that connects in multiples
instances in a lot of remote sites (like home-officer for example) and
needs this information in the prompt to don't lost the context of your
work. Is this valid? Is this and other similar cases quite enough to
justify this patch? If yes I can change the patch to satisfy the Peter's
suggestions, if no we can just ignore the patch and remove the item from
TODO.

Thoughts?

[]s
--
Dickson S. Guedes
mail/xmpp: guedes(at)guedesoft(dot)net - skype: guediz
http://www.postgresql.org.br
http://planeta.postgresql.org.br


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Dickson S(dot) Guedes" <listas(at)guedesoft(dot)net>
Cc: "Peter Eisentraut" <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: WIP patch for TODO Item: Add prompt escape to display the client and server versions
Date: 2009-07-17 21:24:01
Message-ID: 8507.1247865841@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

"Dickson S. Guedes" <listas(at)guedesoft(dot)net> writes:
> Em Thu, 16 Jul 2009 17:40:45 -0300, Peter Eisentraut <peter_e(at)gmx(dot)net>
> escreveu:
>> More generally, does anyone actually need this feature? psql complains
>> loudly enough if the version numbers are not the right ones. I don't
>> know why this would need to be repeated in the prompt.

> An use case that i can figure out is an user that connects in multiples
> instances in a lot of remote sites (like home-officer for example) and
> needs this information in the prompt to don't lost the context of your
> work. Is this valid?

It seems unlikely that the DB version number would be worth the prompt
space. In situations like that you'd much more likely need identifying
info like the DB hostname and port number.

regards, tom lane


From: Dimitri Fontaine <dfontaine(at)hi-media(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Dickson S(dot) Guedes" <listas(at)guedesoft(dot)net>, "Peter Eisentraut" <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: WIP patch for TODO Item: Add prompt escape to display the client and server versions
Date: 2009-07-18 10:14:11
Message-ID: 8EB3E6BC-057E-4CCD-96D9-6E3B98F7C56F@hi-media.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi,

Le 17 juil. 09 à 23:24, Tom Lane a écrit :
> It seems unlikely that the DB version number would be worth the prompt
> space. In situations like that you'd much more likely need
> identifying
> info like the DB hostname and port number.

At work we have a fair number of database servers, some 8.2, lots of
8.3, and still some 8.1 I think. Triple the count for dev and preprod
environments. Of course as the DBA I tend not to forget easily which
server runs which version, and anyway when unsure I read the psql
banner.

But developers too will connect to those servers, and in the same
project they can handle both 8.2 and 8.3 databases. And they already
struggle to think about connecting with the right psql client version.
I'm often called for a "\d is broken, see?".

All of this to say "from the field" how much I think this could help
us to have a rich prompt with database name and major version. Oh and
they could refer to the right documentation, too, before asking me
about why it doesn't work as intended...

Regards,
--
dim


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Dimitri Fontaine <dfontaine(at)hi-media(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Dickson S(dot) Guedes" <listas(at)guedesoft(dot)net>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: WIP patch for TODO Item: Add prompt escape to display the client and server versions
Date: 2009-07-19 11:42:34
Message-ID: 603c8f070907190442m1aa61828ra55fcbceb627caa8@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Sat, Jul 18, 2009 at 6:14 AM, Dimitri Fontaine<dfontaine(at)hi-media(dot)com> wrote:
> Le 17 juil. 09 à 23:24, Tom Lane a écrit :
>>
>> It seems unlikely that the DB version number would be worth the prompt
>> space.  In situations like that you'd much more likely need identifying
>> info like the DB hostname and port number.
>
> At work we have a fair number of database servers, some 8.2, lots of 8.3,
> and still some 8.1 I think. Triple the count for dev and preprod
> environments. Of course as the DBA I tend not to forget easily which server
> runs which version, and anyway when unsure I read the psql banner.
>
> But developers too will connect to those servers, and in the same project
> they can handle both 8.2 and 8.3 databases. And they already struggle to
> think about connecting with the right psql client version. I'm often called
> for a "\d is broken, see?".
>
> All of this to say "from the field" how much I think this could help us to
> have a rich prompt with database name and major version. Oh and they could
> refer to the right documentation, too, before asking me about why it doesn't
> work as intended...

I agree. Probably most people will not use this most of the time, but
frequency of use is not necessarily a good criterion for deciding on
whether to have a feature. Instead, I think we should look at what
the downsides are and if they aren't significant, then we should
provide it. In this case, the only apparent downsides are a slight
increase in the code maintenance burden (because it adds a slight
amount of code) and the fact that it uses up two more %-escapes from a
limited set of usable characters.

But neither of those arguments impresses me very much. We currently
have 11 defined single-character %-escapes and it appears that no new
ones have been added since, at the latest, 2003. (I'm too lazy to
check the commit that shows up in 'git blame' actually added the line
for %x or just modified it.) So there is hardly a run on the
namespace, and as for code maintenance we are talking about a very
short patch.

There is a distributed benefit to PostgreSQL in having a rich feature
set. When people look for a feature, they often find that it is
already there. That is a sign of a good product. We should continue
to aim for that goal.

...Robert


From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-hackers(at)postgresql(dot)org
Cc: "Dickson S(dot) Guedes" <listas(at)guedesoft(dot)net>
Subject: Re: WIP patch for TODO Item: Add prompt escape to display the client and server versions
Date: 2009-07-21 19:52:48
Message-ID: 200907212253.05752.peter_e@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Friday 17 July 2009 23:24:16 Dickson S. Guedes wrote:
> An use case that i can figure out is an user that connects in multiples
> instances in a lot of remote sites (like home-officer for example) and
> needs this information in the prompt to don't lost the context of your
> work. Is this valid? Is this and other similar cases quite enough to
> justify this patch? If yes I can change the patch to satisfy the Peter's
> suggestions, if no we can just ignore the patch and remove the item from
> TODO.

I think there is enough support for the patch. So please adjust it to report
the server version correctly.


From: "Dickson S(dot) Guedes" <listas(at)guedesoft(dot)net>
To: "Peter Eisentraut" <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: WIP patch for TODO Item: Add prompt escape to display the client and server versions
Date: 2009-07-21 19:55:19
Message-ID: op.uxfoahuiij9ntq@analise3.cresoltec.com.br
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Em Tue, 21 Jul 2009 16:52:48 -0300, Peter Eisentraut <peter_e(at)gmx(dot)net>
escreveu:
> On Friday 17 July 2009 23:24:16 Dickson S. Guedes wrote:
>> An use case that i can figure out is an user that connects in multiples
>> instances in a lot of remote sites (like home-officer for example) and
>> needs this information in the prompt to don't lost the context of your
>> work. Is this valid? Is this and other similar cases quite enough to
>> justify this patch? If yes I can change the patch to satisfy the Peter's
>> suggestions, if no we can just ignore the patch and remove the item from
>> TODO.
>
> I think there is enough support for the patch. So please adjust it to
> report the server version correctly.

Thanks Peter, I'll adjust the patch and post a new version ASAP.

Regards.
--
Dickson S. Guedes
mail/xmpp: guedes(at)guedesoft(dot)net - skype: guediz
http://guedesoft.net - http://www.postgresql.org.br
http://www.rnp.br/keyserver/pks/lookup?search=0x8F3E3C06D428D10A


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: "Dickson S(dot) Guedes" <listas(at)guedesoft(dot)net>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: WIP patch for TODO Item: Add prompt escape to display the client and server versions
Date: 2009-07-29 21:22:54
Message-ID: 603c8f070907291422w7ec3f750o5d771ac9ef5da787@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, Jul 21, 2009 at 3:55 PM, Dickson S. Guedes<listas(at)guedesoft(dot)net> wrote:
>> I think there is enough support for the patch.  So please adjust it to
>> report the server version correctly.
>
> Thanks Peter, I'll adjust the patch and post a new version ASAP.

As this patch was reviewed over a week ago and has not been updated, I
am marking it "Returned with Feedback". Please resubmit for
CommitFest 2009-09.

Thanks,

...Robert