Prevent psql version banner from being printed by the \c command if the
authorBruce Momjian
Tue, 16 Feb 2010 21:07:01 +0000 (21:07 +0000)
committerBruce Momjian
Tue, 16 Feb 2010 21:07:01 +0000 (21:07 +0000)
versions match, per report from Peter.

src/bin/psql/command.c
src/bin/psql/command.h
src/bin/psql/startup.c

index 74119fd29f0c927ba132c7502c6c2ba6f8c15abe..54566c818f25fccad9aa5430ac76922b29a83c5c 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 2000-2010, PostgreSQL Global Development Group
  *
- * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.214 2010/02/05 03:09:05 joe Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.215 2010/02/16 21:07:01 momjian Exp $
  */
 #include "postgres_fe.h"
 #include "command.h"
@@ -1331,7 +1331,7 @@ do_connect(char *dbname, char *user, char *host, char *port)
    PQsetNoticeProcessor(n_conn, NoticeProcessor, NULL);
    pset.db = n_conn;
    SyncVariables();
-   connection_warnings();      /* Must be after SyncVariables */
+   connection_warnings(false);     /* Must be after SyncVariables */
 
    /* Tell the user about the new connection */
    if (!pset.quiet)
@@ -1357,7 +1357,7 @@ do_connect(char *dbname, char *user, char *host, char *port)
 
 
 void
-connection_warnings(void)
+connection_warnings(bool in_startup)
 {
    if (!pset.quiet && !pset.notty)
    {
@@ -1383,7 +1383,8 @@ connection_warnings(void)
            printf(_("%s (%s, server %s)\n"),
                   pset.progname, PG_VERSION, server_version);
        }
-       else
+       /* For version match, only print psql banner on startup. */
+       else if (in_startup)
            printf("%s (%s)\n", pset.progname, PG_VERSION);
 
        if (pset.sversion / 100 != client_ver / 100)
index 64f55040086203281efbba9147479695e70e2e25..616df1d5af752d737ef4917f19c0c13ed95522f0 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 2000-2010, PostgreSQL Global Development Group
  *
- * $PostgreSQL: pgsql/src/bin/psql/command.h,v 1.33 2010/01/02 16:57:59 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/command.h,v 1.34 2010/02/16 21:07:01 momjian Exp $
  */
 #ifndef COMMAND_H
 #define COMMAND_H
@@ -34,7 +34,7 @@ extern bool do_pset(const char *param,
        printQueryOpt *popt,
        bool quiet);
 
-extern void connection_warnings(void);
+extern void connection_warnings(bool in_startup);
 
 extern void SyncVariables(void);
 
index c45a869d92cd0f72f070319ea216b5be3e92224f..3f49702394576e3c11752f2cbd27ccf47cbfa64f 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 2000-2010, PostgreSQL Global Development Group
  *
- * $PostgreSQL: pgsql/src/bin/psql/startup.c,v 1.160 2010/02/05 03:09:05 joe Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/startup.c,v 1.161 2010/02/16 21:07:01 momjian Exp $
  */
 #include "postgres_fe.h"
 
@@ -294,7 +294,7 @@ main(int argc, char *argv[])
        if (!options.no_psqlrc)
            process_psqlrc(argv[0]);
 
-       connection_warnings();
+       connection_warnings(true);
        if (!pset.quiet && !pset.notty)
            printf(_("Type \"help\" for help.\n\n"));
        if (!pset.notty)