Commit 5b92ef44 authored by Tom Lane's avatar Tom Lane

Kibitzing on \conninfo patch: adjust the order of field output to match

the parameters of \connect, and fix oversight of not enabling translation
of the messages.  Also, adjust \connect's similar messages to match, and
deal with 8.2-era violation of basic translatability guidelines there.
parent 83527b13
<!-- <!--
$PostgreSQL: pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.246 2010/07/20 03:54:19 rhaas Exp $ $PostgreSQL: pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.247 2010/08/03 18:33:09 tgl Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -784,8 +784,7 @@ testdb=&gt; ...@@ -784,8 +784,7 @@ testdb=&gt;
<term><literal>\conninfo</literal></term> <term><literal>\conninfo</literal></term>
<listitem> <listitem>
<para> <para>
Outputs connection information about the current database Outputs information about the current database connection.
connection.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
......
...@@ -3,7 +3,7 @@ ...@@ -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.224 2010/07/23 14:56:54 rhaas Exp $ * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.225 2010/08/03 18:33:09 tgl Exp $
*/ */
#include "postgres_fe.h" #include "postgres_fe.h"
#include "command.h" #include "command.h"
...@@ -301,21 +301,18 @@ exec_command(const char *cmd, ...@@ -301,21 +301,18 @@ exec_command(const char *cmd,
char *host = PQhost(pset.db); char *host = PQhost(pset.db);
if (db == NULL) if (db == NULL)
printf("You are not connected.\n"); printf(_("You are not connected.\n"));
else else
{ {
if (host == NULL) if (host == NULL)
host = DEFAULT_PGSOCKET_DIR; host = DEFAULT_PGSOCKET_DIR;
/* /* If the host is an absolute path, the connection is via socket */
* If the host is an absolute path, the connection is via local
* socket.
*/
if (is_absolute_path(host)) if (is_absolute_path(host))
printf("You are connected to database \"%s\" via local socket in \"%s\" at port \"%s\" as user \"%s\".\n", printf(_("You are connected to database \"%s\" as user \"%s\" via socket in \"%s\" at port \"%s\".\n"),
db, host, PQport(pset.db), PQuser(pset.db)); db, PQuser(pset.db), host, PQport(pset.db));
else else
printf("You are connected to database \"%s\" on host \"%s\" at port \"%s\" as user \"%s\".\n", printf(_("You are connected to database \"%s\" as user \"%s\" on host \"%s\" at port \"%s\".\n"),
db, host, PQport(pset.db), PQuser(pset.db)); db, PQuser(pset.db), host, PQport(pset.db));
} }
} }
...@@ -1372,26 +1369,24 @@ do_connect(char *dbname, char *user, char *host, char *port) ...@@ -1372,26 +1369,24 @@ do_connect(char *dbname, char *user, char *host, char *port)
/* Tell the user about the new connection */ /* Tell the user about the new connection */
if (!pset.quiet) if (!pset.quiet)
{ {
printf(_("You are now connected to database \"%s\""), PQdb(pset.db)); if (param_is_newly_set(PQhost(o_conn), PQhost(pset.db)) ||
param_is_newly_set(PQport(o_conn), PQport(pset.db)))
if (param_is_newly_set(PQhost(o_conn), PQhost(pset.db)))
{ {
char *host = PQhost(pset.db); char *host = PQhost(pset.db);
/* If the host is an absolute path, the connection is via local socket */ if (host == NULL)
host = DEFAULT_PGSOCKET_DIR;
/* If the host is an absolute path, the connection is via socket */
if (is_absolute_path(host)) if (is_absolute_path(host))
printf(_(" via local socket in \"%s\""), host); printf(_("You are now connected to database \"%s\" as user \"%s\" via socket in \"%s\" at port \"%s\".\n"),
PQdb(pset.db), PQuser(pset.db), host, PQport(pset.db));
else else
printf(_(" on host \"%s\""), host); printf(_("You are now connected to database \"%s\" as user \"%s\" on host \"%s\" at port \"%s\".\n"),
PQdb(pset.db), PQuser(pset.db), host, PQport(pset.db));
} }
else
if (param_is_newly_set(PQport(o_conn), PQport(pset.db))) printf(_("You are now connected to database \"%s\" as user \"%s\".\n"),
printf(_(" at port \"%s\""), PQport(pset.db)); PQdb(pset.db), PQuser(pset.db));
if (param_is_newly_set(PQuser(o_conn), PQuser(pset.db)))
printf(_(" as user \"%s\""), PQuser(pset.db));
printf(".\n");
} }
if (o_conn) if (o_conn)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment