Version checking when loading psql

Started by Greg Sabino Mullaneover 24 years ago14 messagesgeneral
Jump to latest
#1Greg Sabino Mullane
greg@turnstep.com

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Attached is a little patch that simply verifies that the
version of psql you are running is the same as the version
of postgresql you are attaching to. Handy for those times
when you have multiple versions running on different ports,
then put in the wrong port number and post something to
the hackers list wondering why function x is not working.... :)

It spits out a little warning message if the versions are
different, but other than that lets you continue to shoot
yourself in the foot.

Greg Sabino Mullane
greg@turnstep.com
PGP Key: 0x14964AC8 20011191319

-----BEGIN PGP SIGNATURE-----
Comment: http://www.turnstep.com/pgp.html

iQA/AwUBO/lNKbybkGcUlkrIEQJDegCeLr3mEJp82GoTzcOAgLgN3+x+6i0An2mE
HBN+xFOJx/M5bV+bzgXXpwF2
=aaM4
-----END PGP SIGNATURE-----

#2Peter Eisentraut
peter_e@gmx.net
In reply to: Greg Sabino Mullane (#1)
Re: Version checking when loading psql

Greg Sabino Mullane writes:

Attached is a little patch that simply verifies that the
version of psql you are running is the same as the version
of postgresql you are attaching to.

I'm sure this would annoy people.

--
Peter Eisentraut peter_e@gmx.net

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Peter Eisentraut (#2)
Re: [PATCHES] Version checking when loading psql

[ redirected from patches to general ]

Peter Eisentraut <peter_e@gmx.net> writes:

Greg Sabino Mullane writes:

Attached is a little patch that simply verifies that the
version of psql you are running is the same as the version
of postgresql you are attaching to.

I'm sure this would annoy people.

I'm of two minds about it. It'd annoy *me*, but I know we have seen
trouble reports from people who were using version-mismatched psql
and didn't understand why some \d commands didn't work. Maybe we
should be catering more to newbies here.

Any other opinions out there?

regards, tom lane

#4Bruce Momjian
bruce@momjian.us
In reply to: Tom Lane (#3)
Re: [PATCHES] Version checking when loading psql

I'm sure this would annoy people.

I'm of two minds about it. It'd annoy *me*, but I know we have seen
trouble reports from people who were using version-mismatched psql
and didn't understand why some \d commands didn't work. Maybe we
should be catering more to newbies here.

Any other opinions out there?

Seems heavy-handed to warn each time. Could we plop a file in the
user's home directory and warn the first time it doesn't match? That
seems like overkill too. :-)

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
#5Vince Vielhaber
vev@michvhf.com
In reply to: Tom Lane (#3)
Re: [PATCHES] Version checking when loading psql

On Wed, 21 Nov 2001, Tom Lane wrote:

[ redirected from patches to general ]

Peter Eisentraut <peter_e@gmx.net> writes:

Greg Sabino Mullane writes:

Attached is a little patch that simply verifies that the
version of psql you are running is the same as the version
of postgresql you are attaching to.

I'm sure this would annoy people.

I'm of two minds about it. It'd annoy *me*, but I know we have seen
trouble reports from people who were using version-mismatched psql
and didn't understand why some \d commands didn't work. Maybe we
should be catering more to newbies here.

Any other opinions out there?

I'd rather know than not know. But anything more than a warning on
connect would be truly annoying. We've had mismatches on the hub
machines.

Vince.
--
==========================================================================
Vince Vielhaber -- KA8CSH email: vev@michvhf.com http://www.pop4.net
56K Nationwide Dialup from $16.00/mo at Pop4 Networking
Online Campground Directory http://www.camping-usa.com
Online Giftshop Superstore http://www.cloudninegifts.com
==========================================================================

#6Tom Lane
tgl@sss.pgh.pa.us
In reply to: Vince Vielhaber (#5)
Re: [PATCHES] Version checking when loading psql

Vince Vielhaber <vev@zippy.pop4.net> writes:

Any other opinions out there?

I'd rather know than not know. But anything more than a warning on
connect would be truly annoying.

It was only a warning, not a refusal to proceed --- I doubt anyone
would hold still for the latter.

One point that may or may not sway anyone's opinion is that this would
require an extra query cycle during psql startup, meaning slower psql
launch.

regards, tom lane

#7Noname
wsheldah@lexmark.com
In reply to: Tom Lane (#6)
Re: [PATCHES] Version checking when loading psql

How hard would it be to do the check only when reporting on a failed command.
Something like "[command] failed. Could it be because you're using psql version
X and connected to Postgresql version Y?" That way you would have a hint when
something failed, but otherwise wouldn't have to worry about it. Unless some
commands didn't work by returning bad results without actually "failing" with an
error message....

Tom Lane <tgl%sss.pgh.pa.us@interlock.lexmark.com> on 11/21/2001 10:12:02 AM

To: Peter Eisentraut <peter_e%gmx.net@interlock.lexmark.com>
cc: Greg Sabino Mullane <greg%turnstep.com@interlock.lexmark.com>,
pgsql-general%postgresql.org@interlock.lexmark.com (bcc: Wesley
Sheldahl/Lex/Lexmark)
Subject: Re: [GENERAL] [PATCHES] Version checking when loading psql

[ redirected from patches to general ]

Peter Eisentraut <peter_e@gmx.net> writes:

Greg Sabino Mullane writes:

Attached is a little patch that simply verifies that the
version of psql you are running is the same as the version
of postgresql you are attaching to.

I'm sure this would annoy people.

I'm of two minds about it. It'd annoy *me*, but I know we have seen
trouble reports from people who were using version-mismatched psql
and didn't understand why some \d commands didn't work. Maybe we
should be catering more to newbies here.

Any other opinions out there?

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

#8Vince Vielhaber
vev@michvhf.com
In reply to: Tom Lane (#6)
Re: [PATCHES] Version checking when loading psql

On Wed, 21 Nov 2001, Tom Lane wrote:

Vince Vielhaber <vev@zippy.pop4.net> writes:

Any other opinions out there?

I'd rather know than not know. But anything more than a warning on
connect would be truly annoying.

It was only a warning, not a refusal to proceed --- I doubt anyone
would hold still for the latter.

One point that may or may not sway anyone's opinion is that this would
require an extra query cycle during psql startup, meaning slower psql
launch.

And after \connect ??

Vince.
--
==========================================================================
Vince Vielhaber -- KA8CSH email: vev@michvhf.com http://www.pop4.net
56K Nationwide Dialup from $16.00/mo at Pop4 Networking
Online Campground Directory http://www.camping-usa.com
Online Giftshop Superstore http://www.cloudninegifts.com
==========================================================================

#9Bruce Momjian
bruce@momjian.us
In reply to: Tom Lane (#6)
Re: [PATCHES] Version checking when loading psql

Vince Vielhaber <vev@zippy.pop4.net> writes:

Any other opinions out there?

I'd rather know than not know. But anything more than a warning on
connect would be truly annoying.

It was only a warning, not a refusal to proceed --- I doubt anyone
would hold still for the latter.

One point that may or may not sway anyone's opinion is that this would
require an extra query cycle during psql startup, meaning slower psql
launch.

Ewe, that is a negative.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
#10Andrew Sullivan
andrew@libertyrms.info
In reply to: Tom Lane (#3)
Re: [PATCHES] Version checking when loading psql

On Wed, Nov 21, 2001 at 10:12:02AM -0500, Tom Lane wrote:

Peter Eisentraut <peter_e@gmx.net> writes:

Greg Sabino Mullane writes:

Attached is a little patch that simply verifies that the
version of psql you are running is the same as the version
of postgresql you are attaching to.

I'm sure this would annoy people.

I'm of two minds about it. [. . .]

Any other opinions out there?

Depends what it'd do. If it would disconnect you, well then, very
bad. If it would just send a warning ("mismatched psq & postgres:
some features may not work"), well, nothing wrong with that. It
might cut down on the questions and such. But if it disables you
completely, well, ug. No functionality is certainly worse than
limited functionality.

A

-- 
----
Andrew Sullivan                               87 Mowat Avenue 
Liberty RMS                           Toronto, Ontario Canada
<andrew@libertyrms.info>                              M6K 3E3
                                         +1 416 646 3304 x110
#11Peter Eisentraut
peter_e@gmx.net
In reply to: Tom Lane (#3)
Re: [PATCHES] Version checking when loading psql

Tom Lane writes:

I'm of two minds about it. It'd annoy *me*, but I know we have seen
trouble reports from people who were using version-mismatched psql
and didn't understand why some \d commands didn't work. Maybe we
should be catering more to newbies here.

Maybe only print the warning when a \d command is used (immediately
before or after). However, I'd much rather make the \d commands
compatible a version or two back.

--
Peter Eisentraut peter_e@gmx.net

#12Colin 't Hart
cthart@yahoo.com
In reply to: Peter Eisentraut (#2)
Re: Version checking when loading psql

Why not do like the DBMS that we (partially) emulate :-)
and show the versions of the psql app and the server to
which you are connected?

Does psql have a verbose mode where this could be switched
on?

Cheers,

Colin

#13Alvaro Herrera
alvherre@atentus.com
In reply to: Tom Lane (#3)
Re: [PATCHES] Version checking when loading psql

On Wed, 21 Nov 2001, Tom Lane wrote:

Peter Eisentraut <peter_e@gmx.net> writes:

Greg Sabino Mullane writes:

Attached is a little patch that simply verifies that the
version of psql you are running is the same as the version
of postgresql you are attaching to.

I'm sure this would annoy people.

I'm of two minds about it. It'd annoy *me*, but I know we have seen
trouble reports from people who were using version-mismatched psql
and didn't understand why some \d commands didn't work. Maybe we
should be catering more to newbies here.

What about refusing to connect with unmatching versions unless you have
some environment variable set?

This way, newbies will have their connection refused and will have to
take some action (at least read some docs as to how to make it work),
but those who know better can just use it right away.

--
Alvaro Herrera (<alvherre[@]atentus.com>)
"El miedo atento y previsor es la madre de la seguridad" (E. Burke)

#14Greg Sabino Mullane
greg@turnstep.com
In reply to: Alvaro Herrera (#13)
Re: [PATCHES] Version checking when loading psql

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Some followup comments, on the comments to my patch:
(Forgive me for not attributing names)

First, I'm surprised that there are arguments for not doing
this. Isn't version mismatching a Bad Thing? I recognize that
bleeding edge developers may understand why certain deeply
buried functions may suddenly stop working, but shouldn't
we be discouraging mismatches completely?

How hard would it be to do the check only when reporting on
a failed command.

I'd rather just post a warning at the beginning. No sense in
anyone getting too involved before realizing they are running
the wrong version.

And after \connect ??

No effect. Connect merely connects you to a new database, not
a new server backend. The warning appears once, after the
intro help message, which leads me to:

...this would require an extra query cycle during psql
startup, meaning slower psql launch.

Ewe, that is a negative.

Well, it simply calls "select version()" and does a few
C functions. On my system, I clocked the time to do all
this at 1/100th of a second, so this seems like a non-issue.

Depends what it'd do. If it would disconnect you...

For those who may not have seen the original patch post,
it compares the version of psql with the postgresql
server, and outputs a one-line warning message if the
two are not equal. Users can then ignore or heed the
warning as they see fit. :)

Greg Sabino Mullane
greg@turnstep.com
PGP Key: 0x14964AC8 200111261359

-----BEGIN PGP SIGNATURE-----
Comment: http://www.turnstep.com/pgp.html

iQA/AwUBPAKRprybkGcUlkrIEQIFwACfbJLwNQ8V6Wpskl3J/C3hAIeWrioAn2Ei
Ly0hgn4W/LHjvFbXyt9lqHws
=KfAL
-----END PGP SIGNATURE-----