On Mon, 21 Apr 2008 13:17:40 -0700
"Joshua D. Drake" <[EMAIL PROTECTED]> wrote:

Hello,

Attached is v2 of this patch. The following changes have been made:

 * If there is not a version mismatch, psql tells you nothing but ask
for help if you need it.
 * If there is a version mismatch it tells you and still tells you to
type help if you need it

I have modified mainloop.c to deal with help in this instance.

Joshua D. Drake


-- 
The PostgreSQL Company since 1997: http://www.commandprompt.com/ 
PostgreSQL Community Conference: http://www.postgresqlconference.org/
United States PostgreSQL Association: http://www.postgresql.us/
Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate


? psql-Log
? psql_patch.diff
? psql_patch_v2.diff
Index: help.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/bin/psql/help.c,v
retrieving revision 1.126
diff -c -r1.126 help.c
*** help.c	4 Apr 2008 18:00:25 -0000	1.126
--- help.c	22 Apr 2008 21:25:55 -0000
***************
*** 168,173 ****
--- 168,175 ----
  	 * if this " is the start of the string then it ought to end there to fit
  	 * in 80 columns >> "
  	 */
+ 	fprintf(output, _("Execution\n"));
+ 	fprintf(output, _("  \\g or ;	 execute query\n\n"));
  	fprintf(output, _("General\n"));
  	fprintf(output, _("  \\c[onnect] [DBNAME|- USER|- HOST|- PORT|-]\n"
  			"                 connect to new database (currently \"%s\")\n"),
Index: mainloop.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/bin/psql/mainloop.c,v
retrieving revision 1.90
diff -c -r1.90 mainloop.c
*** mainloop.c	5 Apr 2008 03:40:15 -0000	1.90
--- mainloop.c	22 Apr 2008 21:25:55 -0000
***************
*** 177,186 ****
  			(line[4] == '\0' || line[4] == ';' || isspace((unsigned char) line[4])))
  		{
  			free(line);
! 			puts(_("You are using psql, the command-line interface to PostgreSQL."));
! 			puts(_("Enter SQL commands, or type \\? for a list of backslash options."));
! 			puts(_("Use \\h for SQL command help."));
! 			puts(_("Use \\q to quit."));
  			fflush(stdout);
  			continue;
  		}
--- 177,189 ----
  			(line[4] == '\0' || line[4] == ';' || isspace((unsigned char) line[4])))
  		{
  			free(line);
! 			puts(_("\n"));
! 			puts(_("You are using psql, the command-line interface to PostgreSQL.\n"));
! 			puts(_("\tFor SQL help type \\h or \\help ."));
! 			puts(_("\tFor help using psql type \\? ."));
! 			puts(_("\tTo quit psql type \\q . \n"));
! 			puts(_("\tTo view the copyright type \\c . \n"));
! 
  			fflush(stdout);
  			continue;
  		}
Index: startup.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/bin/psql/startup.c,v
retrieving revision 1.146
diff -c -r1.146 startup.c
*** startup.c	1 Jan 2008 19:45:56 -0000	1.146
--- startup.c	22 Apr 2008 21:25:55 -0000
***************
*** 314,341 ****
  							 pset.sversion % 100);
  					server_version = server_ver_str;
  				}
- 
- 				printf(_("Welcome to %s %s (server %s), the PostgreSQL interactive terminal.\n\n"),
- 					   pset.progname, PG_VERSION, server_version);
  			}
- 			else
- 				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"
! 						 "but your %s client is major version %d.%d.  Some backslash commands,\n"
! 						 "such as \\d, might not work properly.\n\n"),
! 					   pset.sversion / 10000, (pset.sversion / 100) % 100,
  					   pset.progname,
  					   client_ver / 10000, (client_ver / 100) % 100);
  
  #ifdef USE_SSL
  			printSSLInfo();
  #endif
--- 314,328 ----
  							 pset.sversion % 100);
  					server_version = server_ver_str;
  				}
  			}
  			if (pset.sversion / 100 != client_ver / 100)
! 				printf(_("\nWARNING: Server %d.%d, %s is version %d.%d. Some psql features may not work.\n\n"),
! 						pset.sversion / 10000, (pset.sversion / 100) % 100,
  					   pset.progname,
  					   client_ver / 10000, (client_ver / 100) % 100);
  
+ 		   printf(_("Type: help for help. \n"));
+ 
  #ifdef USE_SSL
  			printSSLInfo();
  #endif
-- 
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