Skip to content

Commit 9263d86

Browse files
committed
Update psql startup banner to be shorter, suggest "help" for help.
Add a few "help" entries. Move \g help entry into "General". Update psql version mismatch warning text. Joshua D. Drake
1 parent 7adddb4 commit 9263d86

File tree

5 files changed

+33
-45
lines changed

5 files changed

+33
-45
lines changed

doc/src/sgml/ref/psql-ref.sgml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.205 2008/05/16 16:59:05 momjian Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.206 2008/05/16 17:17:00 momjian Exp $
33
PostgreSQL documentation
44
-->
55

@@ -571,13 +571,10 @@ $ <userinput>psql "service=myservice sslmode=require"</userinput>
571571
the string <literal>=&gt;</literal>. For example:
572572
<programlisting>
573573
$ <userinput>psql testdb</userinput>
574-
Welcome to psql &version;, the PostgreSQL interactive terminal.
574+
psql (&version;)
575+
Type "help" for help.
575576

576-
Type: \copyright for distribution terms
577-
\h for help with SQL commands
578-
\? for help with psql commands
579-
\g or terminate with semicolon to execute query
580-
\q to quit
577+
test=>
581578

582579
testdb=&gt;
583580
</programlisting>

doc/src/sgml/start.sgml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/start.sgml,v 1.46 2008/01/23 02:04:47 tgl Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/start.sgml,v 1.47 2008/05/16 17:17:00 momjian Exp $ -->
22

33
<chapter id="tutorial-start">
44
<title>Getting Started</title>
@@ -329,13 +329,8 @@ createdb: database creation failed: ERROR: permission denied to create database
329329
In <command>psql</command>, you will be greeted with the following
330330
message:
331331
<screen>
332-
Welcome to psql &version;, the PostgreSQL interactive terminal.
333-
334-
Type: \copyright for distribution terms
335-
\h for help with SQL commands
336-
\? for help with psql commands
337-
\g or terminate with semicolon to execute query
338-
\q to quit
332+
psql (&version;)
333+
Type "help" for help.
339334

340335
mydb=&gt;
341336
</screen>

src/bin/psql/help.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2008, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/help.c,v 1.127 2008/05/14 15:30:22 momjian Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/help.c,v 1.128 2008/05/16 17:17:00 momjian Exp $
77
*/
88
#include "postgres_fe.h"
99

@@ -170,13 +170,13 @@ slashUsage(unsigned short int pager)
170170
*/
171171
fprintf(output, _("General\n"));
172172
fprintf(output, _(" \\copyright show PostgreSQL usage and distribution terms\n"));
173+
fprintf(output, _(" \\g [FILE] or ; execute query (and send results to file or |pipe)\n"));
173174
fprintf(output, _(" \\h [NAME] help on syntax of SQL commands, * for all commands\n"));
174175
fprintf(output, _(" \\q quit psql\n"));
175176
fprintf(output, "\n");
176177

177178
fprintf(output, _("Query Buffer\n"));
178179
fprintf(output, _(" \\e [FILE] edit the query buffer (or file) with external editor\n"));
179-
fprintf(output, _(" \\g [FILE] send query buffer to server (and results to file or |pipe)\n"));
180180
fprintf(output, _(" \\p show the contents of the query buffer\n"));
181181
fprintf(output, _(" \\r reset (clear) the query buffer\n"));
182182
#ifdef USE_READLINE

src/bin/psql/mainloop.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2008, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/mainloop.c,v 1.90 2008/04/05 03:40:15 tgl Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/mainloop.c,v 1.91 2008/05/16 17:17:00 momjian Exp $
77
*/
88
#include "postgres_fe.h"
99
#include "mainloop.h"
@@ -177,10 +177,13 @@ MainLoop(FILE *source)
177177
(line[4] == '\0' || line[4] == ';' || isspace((unsigned char) line[4])))
178178
{
179179
free(line);
180-
puts(_("You are using psql, the command-line interface to PostgreSQL."));
181-
puts(_("Enter SQL commands, or type \\? for a list of backslash options."));
182-
puts(_("Use \\h for SQL command help."));
183-
puts(_("Use \\q to quit."));
180+
puts(_("\nYou are using psql, the command-line interface to PostgreSQL."));
181+
puts(_("\t\\? for psql help"));
182+
puts(_("\t\\h or \\help for SQL help\n"));
183+
puts(_("\t\\g or \";\" to execute a query"));
184+
puts(_("\t\\q to quit psql\n"));
185+
puts(_("\t\\copyright to view the copyright\n"));
186+
184187
fflush(stdout);
185188
continue;
186189
}

src/bin/psql/startup.c

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2008, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/startup.c,v 1.147 2008/05/08 17:04:26 momjian Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/startup.c,v 1.148 2008/05/16 17:17:00 momjian Exp $
77
*/
88
#include "postgres_fe.h"
99

@@ -317,33 +317,26 @@ main(int argc, char *argv[])
317317
server_version = server_ver_str;
318318
}
319319

320-
printf(_("Welcome to %s %s (server %s), the PostgreSQL interactive terminal.\n\n"),
321-
pset.progname, PG_VERSION, server_version);
320+
printf(_("%s (%s, server %s)\n"),
321+
pset.progname, PG_VERSION, server_version);
322322
}
323323
else
324-
printf(_("Welcome to %s %s, the PostgreSQL interactive terminal.\n\n"),
325-
pset.progname, PG_VERSION);
326-
327-
printf(_("Type: \\copyright for distribution terms\n"
328-
" \\h for help with SQL commands\n"
329-
" \\? for help with psql commands\n"
330-
" \\g or terminate with semicolon to execute query\n"
331-
" \\q to quit\n\n"));
324+
printf("%s (%s)\n", pset.progname, PG_VERSION);
332325

333326
if (pset.sversion / 100 != client_ver / 100)
334-
printf(_("WARNING: You are connected to a server with major version %d.%d,\n"
335-
"but your %s client is major version %d.%d. Some backslash commands,\n"
336-
"such as \\d, might not work properly.\n\n"),
337-
pset.sversion / 10000, (pset.sversion / 100) % 100,
338-
pset.progname,
339-
client_ver / 10000, (client_ver / 100) % 100);
327+
printf(_("WARNING: %s version %d.%d, server version %d.%d.\n"
328+
" Some psql features might not work.\n"),
329+
pset.progname, client_ver / 10000, (client_ver / 100) % 100,
330+
pset.sversion / 10000, (pset.sversion / 100) % 100);
340331

341-
#ifdef USE_SSL
342-
printSSLInfo();
343-
#endif
344332
#ifdef WIN32
345333
checkWin32Codepage();
346334
#endif
335+
#ifdef USE_SSL
336+
printSSLInfo();
337+
#endif
338+
339+
printf(_("Type \"help\" for help.\n\n"));
347340
}
348341

349342
if (!pset.notty)
@@ -707,7 +700,7 @@ printSSLInfo(void)
707700
return; /* no SSL */
708701

709702
SSL_get_cipher_bits(ssl, &sslbits);
710-
printf(_("SSL connection (cipher: %s, bits: %i)\n\n"),
703+
printf(_("SSL connection (cipher: %s, bits: %i)\n"),
711704
SSL_get_cipher(ssl), sslbits);
712705
}
713706
#endif
@@ -729,9 +722,9 @@ checkWin32Codepage(void)
729722
concp = GetConsoleCP();
730723
if (wincp != concp)
731724
{
732-
printf(_("Warning: Console code page (%u) differs from Windows code page (%u)\n"
725+
printf(_("WARNING: Console code page (%u) differs from Windows code page (%u)\n"
733726
" 8-bit characters might not work correctly. See psql reference\n"
734-
" page \"Notes for Windows users\" for details.\n\n"),
727+
" page \"Notes for Windows users\" for details.\n"),
735728
concp, wincp);
736729
}
737730
}

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