Re: Version checking when loading psql

Поиск
Список
Период
Сортировка
От Greg Sabino Mullane
Тема Re: Version checking when loading psql
Дата
Msg-id E166Byx-0005WG-00@granger.mail.mindspring.net
обсуждение исходный текст
Ответ на Version checking when loading psql  ("Greg Sabino Mullane" <greg@turnstep.com>)
Список pgsql-patches
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Sorry, sent the wrong version previously. This is the proper
patch, and remembers the echo setting.


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

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

iQA/AwUBO/pqrLybkGcUlkrIEQI8mQCZAYkehIYbaD6A0Zphpg9/2GOiFJwAn1XY
PNlVXOIO7/B85kwZFi322zAh
=cdxw
-----END PGP SIGNATURE-----
*** ./src/bin/psql/startup.c.orig    Mon Nov 19 13:06:15 2001
--- ./src/bin/psql/startup.c    Tue Nov 20 09:08:44 2001
***************
*** 293,298 ****
--- 293,319 ----
  #endif
          }

+
+ /* Warn if connecting to a different version */
+         PGresult   *result;
+         bool echo=false;
+
+         /* Temporarily turn off echoing */
+         if (GetVariable(pset.vars, "ECHO_HIDDEN")) {
+             DeleteVariable(pset.vars, "ECHO_HIDDEN");
+             echo = true;
+         }
+         result = PSQLexec("SELECT version()");
+         if (echo)
+             SetVariableBool(pset.vars, "ECHO_HIDDEN");
+         if (result) {
+             char serverversion[12];
+             sscanf(PQgetvalue(result,0,0), "PostgreSQL %s", serverversion);
+             PQclear(result);
+             if (strcmp(PG_VERSION, serverversion))
+                 printf("WARNING! psql version %s does not match server version %s!\n\n", PG_VERSION, serverversion);
+         }
+
          SetVariable(pset.vars, "PROMPT1", DEFAULT_PROMPT1);
          SetVariable(pset.vars, "PROMPT2", DEFAULT_PROMPT2);
          SetVariable(pset.vars, "PROMPT3", DEFAULT_PROMPT3);

В списке pgsql-patches по дате отправления:

Предыдущее
От: Joe Conway
Дата:
Сообщение: bytea datatype documentation patch
Следующее
От: Marko Kreen
Дата:
Сообщение: fix pgcrypto usage of uint