Stephen Frost wrote:
> I'd recommend an option in .psqlrc to disable it, if possible.  That
> would be in line with what alot of other "splash-screen" type things do.

I like that idea.  Here is a minimal patch that allows you to put

\set WELCOME_MESSAGE none

or

\set WELCOME_MESSAGE terse

into .psqlrc.  The latter keeps the version information but omits the 
information about the backslash commands.  I didn't change any of the message 
wordings.  Simon's argument that screenshots and HOWTOs would need to be 
updated is not invalid.

I think everyone will find a mode they like here.
diff -cr ../cvs-pgsql/src/bin/psql/startup.c src/bin/psql/startup.c
*** ../cvs-pgsql/src/bin/psql/startup.c	2008-01-05 11:58:50.000000000 +0100
--- src/bin/psql/startup.c	2008-04-19 14:47:05.000000000 +0200
***************
*** 291,300 ****
  	 */
  	else
  	{
  		if (!options.no_psqlrc)
  			process_psqlrc(argv[0]);
  
! 		if (!pset.quiet && !pset.notty)
  		{
  			int			client_ver = parse_version(PG_VERSION);
  
--- 291,304 ----
  	 */
  	else
  	{
+ 		const char *var_welcome_message;
+ 
  		if (!options.no_psqlrc)
  			process_psqlrc(argv[0]);
  
! 		var_welcome_message = GetVariable(pset.vars, "WELCOME_MESSAGE");
! 
! 		if (!pset.quiet && !pset.notty && !(var_welcome_message && strcmp(var_welcome_message, "none") == 0))
  		{
  			int			client_ver = parse_version(PG_VERSION);
  
***************
*** 322,332 ****
  				printf(_("Welcome to %s %s, the PostgreSQL interactive terminal.\n\n"),
  					   pset.progname, PG_VERSION);
  
! 			printf(_("Type:  \\copyright for distribution terms\n"
! 					 "       \\h for help with SQL commands\n"
! 					 "       \\? for help with psql commands\n"
! 				  "       \\g or terminate with semicolon to execute query\n"
! 					 "       \\q to quit\n\n"));
  
  			if (pset.sversion / 100 != client_ver / 100)
  				printf(_("WARNING:  You are connected to a server with major version %d.%d,\n"
--- 326,337 ----
  				printf(_("Welcome to %s %s, the PostgreSQL interactive terminal.\n\n"),
  					   pset.progname, PG_VERSION);
  
! 			if (!(var_welcome_message && strcmp(var_welcome_message, "terse") == 0))
! 				printf(_("Type:  \\copyright for distribution terms\n"
! 						 "       \\h for help with SQL commands\n"
! 						 "       \\? for help with psql commands\n"
! 						 "       \\g or terminate with semicolon to execute query\n"
! 						 "       \\q to quit\n\n"));
  
  			if (pset.sversion / 100 != client_ver / 100)
  				printf(_("WARNING:  You are connected to a server with major version %d.%d,\n"
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to