Warn the user if connecting to a newer version of the server than is supported.
authordpage <dpage@a7884b65-44f6-0310-8a51-81a127f17b15>
Tue, 13 Jan 2009 14:52:50 +0000 (14:52 +0000)
committerdpage <dpage@a7884b65-44f6-0310-8a51-81a127f17b15>
Tue, 13 Jan 2009 14:52:50 +0000 (14:52 +0000)
git-svn-id: svn://svn.pgadmin.org/trunk/pgadmin3@7549 a7884b65-44f6-0310-8a51-81a127f17b15

CHANGELOG
pgadmin/include/pgAdmin3.h
pgadmin/schema/pgServer.cpp

index a0dea320e974c60da923ff9364e37185ea3861f2..c95ff1958e1a454bd1d81efa2d31b67f552c30ec 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -36,6 +36,8 @@ Changes
 \r
 Date       Dev Ver    Change details\r
 ---------- --- -----  --------------\r
+2009-01-13 DP  1.9.0  Warn the user if connecting to a newer version of the\r
+                      server than is supported.\r
 2009-01-12 DP  1.9.0  Add support for Window functions [Ashesh Vashi]\r
 2009-01-09 DP  1.9.0  Add an option to ignore server version mismatches with\r
                       pg_dump/pg_dumpall/pg_restore.\r
index 947d62a5989b34d50219d0ed6f749708d68d436d..3193ecfae5cf91df78bdb97f8838267d4b2c3cc0 100644 (file)
 #error wxWidgets must be compiled with Unicode support to build pgAdmin.
 #endif
 
-const float SERVER_MIN_VERSION = 7.3f;
+// Supported server minimum and maximum values.
+const short SERVER_MIN_VERSION_N = 0x0703;
+const wxString SERVER_MIN_VERSION_T = wxT("7.3");
+const short SERVER_MAX_VERSION_N = 0x0804;
+const wxString SERVER_MAX_VERSION_T = wxT("8.4");
 
 // The registry file
 #ifndef __WXMSW__
index 04e4bffc4c2339a354cdec63bef692190829aa10..7e00dc8d56e0c09246c44bd1d6ead945cc67537f 100644 (file)
@@ -628,8 +628,12 @@ int pgServer::Connect(frmMain *form, bool askPassword, const wxString &pwd, bool
         dbOid = conn->GetDbOid();
 
         // Check the server version
-        if (conn->BackendMinimumVersion(7, 3))
+        if (conn->BackendMinimumVersion(SERVER_MIN_VERSION_N >> 8, SERVER_MIN_VERSION_N & 0x00FF))
         {
+                       // Warn the user if this is a newer version of PostgreSQL than we know of.
+                       if (conn->BackendMinimumVersion(SERVER_MAX_VERSION_N >> 8, (SERVER_MAX_VERSION_N & 0x00FF) + 1))
+                               wxLogWarning(_("This version of pgAdmin has only been tested with PostgreSQL version %s and below and may not function correctly with this server. Please upgrade pgAdmin."), SERVER_MAX_VERSION_T);
+
             connected = true;
             bool hasUptime=false;
 
@@ -688,7 +692,7 @@ int pgServer::Connect(frmMain *form, bool askPassword, const wxString &pwd, bool
         }
         else
         {
-            error.Printf(_("The PostgreSQL server must be at least version %2.1f!"), SERVER_MIN_VERSION);
+            error.Printf(_("The server version %s is older than is supported by this release of pgAdmin."), SERVER_MIN_VERSION_T);
             connected = false;
             status = PGCONN_BAD;
         }