Re: [BUGS] PSQL commands not backwards-compatible - Mailing list pgsql-patches

From Bruce Momjian
Subject Re: [BUGS] PSQL commands not backwards-compatible
Date
Msg-id 200508310346.j7V3kTp11101@candle.pha.pa.us
Whole thread Raw
In response to Re: [BUGS] PSQL commands not backwards-compatible  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [BUGS] PSQL commands not backwards-compatible  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-patches
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"

pgsql-patches by date:

Previous
From: "Marc G. Fournier"
Date:
Subject: Re: [BUGS] PSQL commands not backwards-compatible
Next
From: Michael Fuhr
Date:
Subject: SPI_getbinval() documentation correction