Skip to content

Commit 55ea144

Browse files
committed
Prevent psql version banner from being printed by the \c command if the
versions match, per report from Peter.
1 parent aa7e7ae commit 55ea144

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

src/bin/psql/command.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2010, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.214 2010/02/05 03:09:05 joe Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.215 2010/02/16 21:07:01 momjian Exp $
77
*/
88
#include "postgres_fe.h"
99
#include "command.h"
@@ -1331,7 +1331,7 @@ do_connect(char *dbname, char *user, char *host, char *port)
13311331
PQsetNoticeProcessor(n_conn, NoticeProcessor, NULL);
13321332
pset.db = n_conn;
13331333
SyncVariables();
1334-
connection_warnings(); /* Must be after SyncVariables */
1334+
connection_warnings(false); /* Must be after SyncVariables */
13351335

13361336
/* Tell the user about the new connection */
13371337
if (!pset.quiet)
@@ -1357,7 +1357,7 @@ do_connect(char *dbname, char *user, char *host, char *port)
13571357

13581358

13591359
void
1360-
connection_warnings(void)
1360+
connection_warnings(bool in_startup)
13611361
{
13621362
if (!pset.quiet && !pset.notty)
13631363
{
@@ -1383,7 +1383,8 @@ connection_warnings(void)
13831383
printf(_("%s (%s, server %s)\n"),
13841384
pset.progname, PG_VERSION, server_version);
13851385
}
1386-
else
1386+
/* For version match, only print psql banner on startup. */
1387+
else if (in_startup)
13871388
printf("%s (%s)\n", pset.progname, PG_VERSION);
13881389

13891390
if (pset.sversion / 100 != client_ver / 100)

src/bin/psql/command.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2010, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/command.h,v 1.33 2010/01/02 16:57:59 momjian Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/command.h,v 1.34 2010/02/16 21:07:01 momjian Exp $
77
*/
88
#ifndef COMMAND_H
99
#define COMMAND_H
@@ -34,7 +34,7 @@ extern bool do_pset(const char *param,
3434
printQueryOpt *popt,
3535
bool quiet);
3636

37-
extern void connection_warnings(void);
37+
extern void connection_warnings(bool in_startup);
3838

3939
extern void SyncVariables(void);
4040

src/bin/psql/startup.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2010, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/startup.c,v 1.160 2010/02/05 03:09:05 joe Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/startup.c,v 1.161 2010/02/16 21:07:01 momjian Exp $
77
*/
88
#include "postgres_fe.h"
99

@@ -294,7 +294,7 @@ main(int argc, char *argv[])
294294
if (!options.no_psqlrc)
295295
process_psqlrc(argv[0]);
296296

297-
connection_warnings();
297+
connection_warnings(true);
298298
if (!pset.quiet && !pset.notty)
299299
printf(_("Type \"help\" for help.\n\n"));
300300
if (!pset.notty)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy