Thread: Re: [BUGS] PSQL commands not backwards-compatible
Josh Berkus wrote: > Tom, > > > They've been broken on a fairly regular basis in past releases. > > Certainly 7.3 broke every single one because of the addition of > > schema syntax ... > > Yeah, and we warned people about it, as I recall. Also, we had about 25x > less users then. I think we should put something in the release notes: > > WARNING: 8.1's "psql" is not completely backwards-compatible with previous > versions of PostgreSQL. Here is a patch that will print out (in interactive mode only) a warning message if a newer client connects to an older major numbered server. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073 Index: src/bin/psql/startup.c =================================================================== RCS file: /cvsroot/pgsql/src/bin/psql/startup.c,v retrieving revision 1.120 diff -c -c -r1.120 startup.c *** src/bin/psql/startup.c 25 Jul 2005 17:17:41 -0000 1.120 --- src/bin/psql/startup.c 31 Aug 2005 02:19:12 -0000 *************** *** 8,13 **** --- 8,14 ---- #include "postgres_fe.h" #include <sys/types.h> + #include <math.h> #ifndef WIN32 #include <unistd.h> *************** *** 312,317 **** --- 313,325 ---- if (!QUIET() && !pset.notty) { + if (pset.sversion / 100 < atoi(PG_VERSION) * 100 + + (strchr(PG_VERSION, '.')[1] - '0')) + printf(_("You are connected to a server with an earlier major version\n" + "than your %s client. Informational backslash commands, like \\d,\n" + "might not work properly.\n\n"), + pset.progname); + printf(_("Welcome to %s %s, the PostgreSQL interactive terminal.\n\n" "Type: \\copyright for distribution terms\n" " \\h for help with SQL commands\n"
Could this be back patched to the older versions as well? On Tue, 30 Aug 2005, Bruce Momjian wrote: > Josh Berkus wrote: >> Tom, >> >>> They've been broken on a fairly regular basis in past releases. >>> Certainly 7.3 broke every single one because of the addition of >>> schema syntax ... >> >> Yeah, and we warned people about it, as I recall. Also, we had about 25x >> less users then. I think we should put something in the release notes: >> >> WARNING: 8.1's "psql" is not completely backwards-compatible with previous >> versions of PostgreSQL. > > Here is a patch that will print out (in interactive mode only) a warning > message if a newer client connects to an older major numbered server. > > -- > Bruce Momjian | http://candle.pha.pa.us > pgman@candle.pha.pa.us | (610) 359-1001 > + If your life is a hard drive, | 13 Roberts Road > + Christ can be your backup. | Newtown Square, Pennsylvania 19073 > ---- Marc G. Fournier Hub.Org Networking Services (http://www.hub.org) Email: scrappy@hub.org Yahoo!: yscrappy ICQ: 7615664
Marc G. Fournier wrote: > > Could this be back patched to the older versions as well? Sure. --------------------------------------------------------------------------- > > On Tue, 30 Aug 2005, Bruce Momjian wrote: > > > Josh Berkus wrote: > >> Tom, > >> > >>> They've been broken on a fairly regular basis in past releases. > >>> Certainly 7.3 broke every single one because of the addition of > >>> schema syntax ... > >> > >> Yeah, and we warned people about it, as I recall. Also, we had about 25x > >> less users then. I think we should put something in the release notes: > >> > >> WARNING: 8.1's "psql" is not completely backwards-compatible with previous > >> versions of PostgreSQL. > > > > Here is a patch that will print out (in interactive mode only) a warning > > message if a newer client connects to an older major numbered server. > > > > -- > > Bruce Momjian | http://candle.pha.pa.us > > pgman@candle.pha.pa.us | (610) 359-1001 > > + If your life is a hard drive, | 13 Roberts Road > > + Christ can be your backup. | Newtown Square, Pennsylvania 19073 > > > > ---- > Marc G. Fournier Hub.Org Networking Services (http://www.hub.org) > Email: scrappy@hub.org Yahoo!: yscrappy ICQ: 7615664 > > ---------------------------(end of broadcast)--------------------------- > TIP 9: In versions below 8.0, the planner will ignore your desire to > choose an index scan if your joining column's datatypes do not > match > -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073
Bruce Momjian <pgman@candle.pha.pa.us> writes: > Here is a patch that will print out (in interactive mode only) a warning > message if a newer client connects to an older major numbered server. Why only older? It's even less likely to work if the server is newer. (I don't agree with the premise to begin with...) regards, tom lane
On Tue, 30 Aug 2005, Tom Lane wrote: > Bruce Momjian <pgman@candle.pha.pa.us> writes: >> Here is a patch that will print out (in interactive mode only) a warning >> message if a newer client connects to an older major numbered server. > > Why only older? It's even less likely to work if the server is newer. > > (I don't agree with the premise to begin with...) An example of where this sort of 'obvious warning' is in an environment like ours, where we have several different version of PostgreSQL running, and *try* to make sure each version of psql is available to our clients, but a client inadvertantly runs the wrong version against their database ... its only psql that has the "helper commands", like \d, so the only thing that *really* makes a different between versions ... ---- Marc G. Fournier Hub.Org Networking Services (http://www.hub.org) Email: scrappy@hub.org Yahoo!: yscrappy ICQ: 7615664
Tom Lane wrote: > Bruce Momjian <pgman@candle.pha.pa.us> writes: > > Here is a patch that will print out (in interactive mode only) a warning > > message if a newer client connects to an older major numbered server. > > Why only older? It's even less likely to work if the server is newer. > > (I don't agree with the premise to begin with...) OK, this new patch prints a warning on any major version mismatch, newer or older. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073 Index: src/bin/psql/startup.c =================================================================== RCS file: /cvsroot/pgsql/src/bin/psql/startup.c,v retrieving revision 1.120 diff -c -c -r1.120 startup.c *** src/bin/psql/startup.c 25 Jul 2005 17:17:41 -0000 1.120 --- src/bin/psql/startup.c 31 Aug 2005 02:19:12 -0000 *************** *** 8,13 **** --- 8,14 ---- #include "postgres_fe.h" #include <sys/types.h> + #include <math.h> #ifndef WIN32 #include <unistd.h> *************** *** 312,317 **** --- 313,325 ---- if (!QUIET() && !pset.notty) { + if (pset.sversion / 100 != atoi(PG_VERSION) * 100 + + (strchr(PG_VERSION, '.')[1] - '0')) + printf(_("You are connected to a server with a differnt major version number\n" + "than your %s client. Informational backslash commands, like \\d,\n" + "might not work properly.\n\n"), + pset.progname); + printf(_("Welcome to %s %s, the PostgreSQL interactive terminal.\n\n" "Type: \\copyright for distribution terms\n" " \\h for help with SQL commands\n"
Bruce Momjian wrote: > Tom Lane wrote: > > Bruce Momjian <pgman@candle.pha.pa.us> writes: > > > Here is a patch that will print out (in interactive mode only) a warning > > > message if a newer client connects to an older major numbered server. > > > > Why only older? It's even less likely to work if the server is newer. > > > > (I don't agree with the premise to begin with...) > > OK, this new patch prints a warning on any major version mismatch, newer > or older. Here is an updated patch that shows the major version numbers of the client and server when there is a mismatch. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073 Index: src/bin/psql/startup.c =================================================================== RCS file: /cvsroot/pgsql/src/bin/psql/startup.c,v retrieving revision 1.120 diff -c -c -r1.120 startup.c *** src/bin/psql/startup.c 25 Jul 2005 17:17:41 -0000 1.120 --- src/bin/psql/startup.c 31 Aug 2005 21:31:22 -0000 *************** *** 8,13 **** --- 8,14 ---- #include "postgres_fe.h" #include <sys/types.h> + #include <math.h> #ifndef WIN32 #include <unistd.h> *************** *** 312,317 **** --- 313,326 ---- if (!QUIET() && !pset.notty) { + if (pset.sversion / 100 != atoi(PG_VERSION) * 100 + + (strchr(PG_VERSION, '.')[1] - '0')) + printf(_("You are connected to a server with major version %d.%d, but your\n" + "%s client is major version %d.%d. Informational backslash commands,\n" + "like \\d, might not work properly.\n\n"), + pset.sversion / 10000, (pset.sversion / 100) % 10, + pset.progname, atoi(PG_VERSION), strchr(PG_VERSION, '.')[1] - '0'); + printf(_("Welcome to %s %s, the PostgreSQL interactive terminal.\n\n" "Type: \\copyright for distribution terms\n" " \\h for help with SQL commands\n"