Unix Technical Forum

Patch to change psql default banner

This is a discussion on Patch to change psql default banner within the Pgsql Patches forums, part of the PostgreSQL category; --> On Thu, May 15, 2008 at 06:57:12PM -0400, Tom Lane wrote: > Andrew Dunstan <andrew@dunslane.net> writes: > > David ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > Pgsql Patches

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #41 (permalink)  
Old 05-16-2008, 02:43 PM
David Fetter
 
Posts: n/a
Default Re: Patch to change psql default banner v6

On Thu, May 15, 2008 at 06:57:12PM -0400, Tom Lane wrote:
> Andrew Dunstan <andrew@dunslane.net> writes:
> > David Fetter wrote:
> >> I hate to bike-shed this even further, but I'd like to make those
> >> "incompatibility" messages just go away by making 8.4's psql (and
> >> all those going forward) support every living version of Postgres
> >> at the time of their release,

>
> > I think you must have been out in the sun too long.

>
> Hey, he's welcome to try to do it. But it's utterly unrelated to
> the patch at hand, and we are not holding up the patch at hand until
> something like that happens.


Nor am I suggesting holding up this patch for that reason

Cheers,
David.
--
David Fetter <david@fetter.org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david.fetter@gmail.com

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

--
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #42 (permalink)  
Old 05-16-2008, 02:43 PM
Andrew Dunstan
 
Posts: n/a
Default Re: Patch to change psql default banner v6



David Fetter wrote:
> On Thu, May 15, 2008 at 06:55:31PM -0400, Andrew Dunstan wrote:
>
>> David Fetter wrote:
>>
>>> I hate to bike-shed this even further, but I'd like to make those
>>> "incompatibility" messages just go away by making 8.4's psql (and
>>> all those going forward) support every living version of Postgres
>>> at the time of their release, so 8.4's psql would be able to talk
>>> seamlessly to Postgres 7.4
>>>

>> I think you must have been out in the sun too long.
>>

>
> One thing I really treasure about working on the Postgres project is
> frank feedback.
>


I know you know me well enough to realise there was an implied smiley ;-)

>
>> Just look at the pg_dump code if you want something of an idea of
>> what this would involve.
>>

>
> Given that each previous version tied backslash commands to some
> particular chunk of SQL, what would be the problem with either
> immediately or lazily setting those to the chunks of SQL already
> present in previous versions?
>
>
>


First, this is not a cost free exercise - it increases code complexity
enormously.

Second, it's not nearly as easy as that:
.. new commands have been added
.. postgres features have been added
.. catalogs have changed

Among other things, help and indeed the available command set would have
to become server version sensitive.

And you would greatly increase the bar for anyone wanting to add a new
command - now they (or someone) would have to work out how the command
would or might work n versions back, not just with the current dev version.

Doing it lazily isn't acceptable - if we promise \command compatibility
with previous server versions then we need to deliver it to the maximum
extent possible, and if we don't promise it there's no point in doing this.

And, as Tom says, it has nothing really to do with this patch.

cheers

andrew



--
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #43 (permalink)  
Old 05-16-2008, 02:43 PM
Alvaro Herrera
 
Posts: n/a
Default Re: Patch to change psql default banner v6

Andrew Dunstan wrote:

> Second, it's not nearly as easy as that:
> . new commands have been added
> . postgres features have been added
> . catalogs have changed


Well, this just means a different piece of SQL needs to be sent for a
command depending on the server version, right? It's not like that's
tremendously different. The nice thing about most \X commands is that
they embed everything they need in a bunch of SQL, and they don't need
much else in C code. So it's not all that difficult.

And for commands that have been added later, an initial version could
just say "this server version does not support this command". It would
be already a huge improvement.

Probably the biggest change would be to support versions that did not
have schemas, but I think it would be OK to punt on that. We already
stopped supporting 7.2 anyway.

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

--
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #44 (permalink)  
Old 05-16-2008, 02:43 PM
Andrew Dunstan
 
Posts: n/a
Default Re: Patch to change psql default banner v6



Alvaro Herrera wrote:
> Andrew Dunstan wrote:
>
>
>> Second, it's not nearly as easy as that:
>> . new commands have been added
>> . postgres features have been added
>> . catalogs have changed
>>

>
> Well, this just means a different piece of SQL needs to be sent for a
> command depending on the server version, right? It's not like that's
> tremendously different. The nice thing about most \X commands is that
> they embed everything they need in a bunch of SQL, and they don't need
> much else in C code. So it's not all that difficult.
>
> And for commands that have been added later, an initial version could
> just say "this server version does not support this command". It would
> be already a huge improvement.
>
> Probably the biggest change would be to support versions that did not
> have schemas, but I think it would be OK to punt on that. We already
> stopped supporting 7.2 anyway.
>


Have at it then. Prove me wrong.

cheers

andrew

--
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #45 (permalink)  
Old 05-16-2008, 02:43 PM
Tom Lane
 
Posts: n/a
Default Re: Patch to change psql default banner v6

"Joshua D. Drake" <jd@commandprompt.com> writes:
> Andrew Dunstan wrote:
>> Have at it then. Prove me wrong.


> IMO the problem isn't the one off support for all supported version of
> Pg... say 7.4 -> 8.4. The problem is of on going maintenance.


> /me doesn't think it is worth the effort.


Since no one's done it yet, that would seem to be the consensus
opinion :-)

Still, it'd be interesting to see an attempt at making it go.
The costs of doing it now for existing versions would probably give us
a good idea of what the future maintenance effort might be like.
Without a real patch to look at, we're all just guessing about that.

regards, tom lane

--
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #46 (permalink)  
Old 05-16-2008, 02:43 PM
Joshua D. Drake
 
Posts: n/a
Default Re: Patch to change psql default banner v6

Andrew Dunstan wrote:

>> And for commands that have been added later, an initial version could
>> just say "this server version does not support this command". It would
>> be already a huge improvement.
>>
>> Probably the biggest change would be to support versions that did not
>> have schemas, but I think it would be OK to punt on that. We already
>> stopped supporting 7.2 anyway.
>>

>
> Have at it then. Prove me wrong.


IMO the problem isn't the one off support for all supported version of
Pg... say 7.4 -> 8.4. The problem is of on going maintenance.

/me doesn't think it is worth the effort.

Sincerely,

Joshua D. Drake



--
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #47 (permalink)  
Old 05-16-2008, 02:43 PM
David Fetter
 
Posts: n/a
Default Re: Patch to change psql default banner v6

On Fri, May 16, 2008 at 01:22:55AM -0400, Tom Lane wrote:
> David Fetter <david@fetter.org> writes:
> > I believe there's a bug in this patch, namely that the warnings when
> > there's a server-client mismatch only appear at startup time.

>
> Please do not blame this patch for a problem that has been there all
> along.
>
> I don't say that the point doesn't need investigation, but blaming
> the patch-at-hand for the issue is just misleading.


The patch at hand, as you point out, emphasizes a problem that's been
there all along, namely that \c doesn't do the same things that
command line connection does.

I'm volunteering to make them use the same methods

Cheers,
David.
--
David Fetter <david@fetter.org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david.fetter@gmail.com

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

--
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #48 (permalink)  
Old 05-16-2008, 02:43 PM
Tom Lane
 
Posts: n/a
Default Re: Patch to change psql default banner v6

David Fetter <david@fetter.org> writes:
> I believe there's a bug in this patch, namely that the warnings when
> there's a server-client mismatch only appear at startup time.


Please do not blame this patch for a problem that has been there all
along.

I don't say that the point doesn't need investigation, but blaming
the patch-at-hand for the issue is just misleading.

regards, tom lane

--
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #49 (permalink)  
Old 05-16-2008, 02:43 PM
David Fetter
 
Posts: n/a
Default Re: Patch to change psql default banner v6

On Thu, May 15, 2008 at 03:21:37PM -0400, Bruce Momjian wrote:
> Alvaro Herrera wrote:
> >
> > I'm OK with thisG but please move the printSSLInfo() call just before
> > echoing the help line.

>
> Oh, good catch, moved. I also moved the Win32 code page message up too.
> Patch attached.
>
> I hacked up an example that shows both SSL and Win32 code page messages:


I believe there's a bug in this patch, namely that the warnings when
there's a server-client mismatch only appear at startup time. This is
a pretty clear POLA violation, IMHO.

On my laptop, I have two pg instances running: 8.3.0 on port 5432, CVS
TIP on 2225.

Here's what I get if I invoke psql from the command line:

$ psql -p 5432 postgres
Welcome to psql 8.4devel (server 8.3.0), the PostgreSQL interactive terminal.

Type: \copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit

WARNING: You are connected to a server with major version 8.3,
but your psql client is major version 8.4. Some backslash commands,
such as \d, might not work properly.

Here's what I get if I use \c, having connected to CVS TIP first:

davidfetter@postgres=# \c - - - 5432
You are now connected to database "postgres" at port "5432".

I think that the warning should be consistently there on connect
instead of just at program start.

Not coincidentally, moving all the checks into one spot, i.e. making
startup.c and command.c call and test the same things to connect to a
database, advances my Evil Plan™ to make more interesting things
happen when switching versions

Cheers,
David.
--
David Fetter <david@fetter.org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david.fetter@gmail.com

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

--
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #50 (permalink)  
Old 05-18-2008, 11:03 PM
Bruce Momjian
 
Posts: n/a
Default Re: Patch to change psql default banner v6

Bruce Momjian wrote:
> OK, here is the mega-print:
>
> $ psql test
> psql (8.4devel, server 8.4devel)
> WARNING: psql version 8.4, server version 8.4.
> Some psql features might not work.
> WARNING: Console code page (44) differs from Windows code page (55)
> 8-bit characters might not work correctly. See psql reference
> page "Notes for Windows users" for details.
> SSL connection (cipher: 55, bits: 512)
> Type "help" for help.
>
> test=>
>


Updated patch applied, docs adjusted for new psql startup banner.

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +


--
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 04:37 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com