mirror of
https://github.com/postgres/postgres.git
synced 2025-06-30 21:42:05 +03:00
Prevent psql version banner from being printed by the \c command if the
versions match, per report from Peter.
This commit is contained in:
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 2000-2010, PostgreSQL Global Development Group
|
* 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 "postgres_fe.h"
|
||||||
#include "command.h"
|
#include "command.h"
|
||||||
@ -1331,7 +1331,7 @@ do_connect(char *dbname, char *user, char *host, char *port)
|
|||||||
PQsetNoticeProcessor(n_conn, NoticeProcessor, NULL);
|
PQsetNoticeProcessor(n_conn, NoticeProcessor, NULL);
|
||||||
pset.db = n_conn;
|
pset.db = n_conn;
|
||||||
SyncVariables();
|
SyncVariables();
|
||||||
connection_warnings(); /* Must be after SyncVariables */
|
connection_warnings(false); /* Must be after SyncVariables */
|
||||||
|
|
||||||
/* Tell the user about the new connection */
|
/* Tell the user about the new connection */
|
||||||
if (!pset.quiet)
|
if (!pset.quiet)
|
||||||
@ -1357,7 +1357,7 @@ do_connect(char *dbname, char *user, char *host, char *port)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
connection_warnings(void)
|
connection_warnings(bool in_startup)
|
||||||
{
|
{
|
||||||
if (!pset.quiet && !pset.notty)
|
if (!pset.quiet && !pset.notty)
|
||||||
{
|
{
|
||||||
@ -1383,7 +1383,8 @@ connection_warnings(void)
|
|||||||
printf(_("%s (%s, server %s)\n"),
|
printf(_("%s (%s, server %s)\n"),
|
||||||
pset.progname, PG_VERSION, server_version);
|
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);
|
printf("%s (%s)\n", pset.progname, PG_VERSION);
|
||||||
|
|
||||||
if (pset.sversion / 100 != client_ver / 100)
|
if (pset.sversion / 100 != client_ver / 100)
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 2000-2010, PostgreSQL Global Development Group
|
* 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
|
#ifndef COMMAND_H
|
||||||
#define COMMAND_H
|
#define COMMAND_H
|
||||||
@ -34,7 +34,7 @@ extern bool do_pset(const char *param,
|
|||||||
printQueryOpt *popt,
|
printQueryOpt *popt,
|
||||||
bool quiet);
|
bool quiet);
|
||||||
|
|
||||||
extern void connection_warnings(void);
|
extern void connection_warnings(bool in_startup);
|
||||||
|
|
||||||
extern void SyncVariables(void);
|
extern void SyncVariables(void);
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 2000-2010, PostgreSQL Global Development Group
|
* 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"
|
#include "postgres_fe.h"
|
||||||
|
|
||||||
@ -294,7 +294,7 @@ main(int argc, char *argv[])
|
|||||||
if (!options.no_psqlrc)
|
if (!options.no_psqlrc)
|
||||||
process_psqlrc(argv[0]);
|
process_psqlrc(argv[0]);
|
||||||
|
|
||||||
connection_warnings();
|
connection_warnings(true);
|
||||||
if (!pset.quiet && !pset.notty)
|
if (!pset.quiet && !pset.notty)
|
||||||
printf(_("Type \"help\" for help.\n\n"));
|
printf(_("Type \"help\" for help.\n\n"));
|
||||||
if (!pset.notty)
|
if (!pset.notty)
|
||||||
|
Reference in New Issue
Block a user