aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/src/sgml/ref/psql-ref.sgml6
-rw-r--r--src/bin/psql/command.c4
-rw-r--r--src/bin/psql/describe.c22
-rw-r--r--src/bin/psql/describe.h4
-rw-r--r--src/bin/psql/help.c4
5 files changed, 25 insertions, 15 deletions
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 44b4a91f68f..37c73e22817 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -1,5 +1,5 @@
<!--
-$PostgreSQL: pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.117 2004/07/12 20:41:08 momjian Exp $
+$PostgreSQL: pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.118 2004/07/13 16:48:15 momjian Exp $
PostgreSQL documentation
-->
@@ -990,7 +990,9 @@ testdb=>
Lists all available schemas (namespaces). If <replaceable
class="parameter">pattern</replaceable> (a regular expression)
is specified, only schemas whose names match the pattern are listed.
- Non-local temporary schemas are suppressed.
+ Non-local temporary schemas are suppressed. If <literal>+</literal>
+ is appended to the command name, each object is listed with its associated
+ permissions and description, if any.
</para>
</listitem>
</varlistentry>
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index ba8d623731c..222d761163f 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.120 2004/07/11 21:34:03 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.121 2004/07/13 16:48:16 momjian Exp $
*/
#include "postgres_fe.h"
#include "command.h"
@@ -326,7 +326,7 @@ exec_command(const char *cmd,
success = do_lo_list();
break;
case 'n':
- success = listSchemas(pattern);
+ success = listSchemas(pattern, show_verbose);
break;
case 'o':
success = describeOperators(pattern);
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e9758ec0837..432063640db 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.101 2004/07/13 02:46:21 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.102 2004/07/13 16:48:16 momjian Exp $
*/
#include "postgres_fe.h"
#include "describe.h"
@@ -1693,7 +1693,7 @@ listCasts(const char *pattern)
* Describes schemas (namespaces)
*/
bool
-listSchemas(const char *pattern)
+listSchemas(const char *pattern, bool verbose)
{
PQExpBufferData buf;
PGresult *res;
@@ -1702,13 +1702,21 @@ listSchemas(const char *pattern)
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf,
"SELECT n.nspname AS \"%s\",\n"
- " u.usename AS \"%s\"\n"
- "FROM pg_catalog.pg_namespace n LEFT JOIN pg_catalog.pg_user u\n"
+ " u.usename AS \"%s\"",
+ _("Name"), _("Owner"));
+
+ if (verbose)
+ appendPQExpBuffer(&buf,
+ ",\n n.nspacl as \"%s\","
+ " pg_catalog.obj_description(n.oid, 'pg_namespace') as \"%s\"",
+ _("Access privileges"), _("Description"));
+
+ appendPQExpBuffer(&buf,
+ "\nFROM pg_catalog.pg_namespace n LEFT JOIN pg_catalog.pg_user u\n"
" ON n.nspowner=u.usesysid\n"
"WHERE (n.nspname NOT LIKE 'pg\\\\_temp\\\\_%%' OR\n"
- " n.nspname = (pg_catalog.current_schemas(true))[1])\n", /* temp schema is first */
- _("Name"),
- _("Owner"));
+ " n.nspname = (pg_catalog.current_schemas(true))[1])\n"); /* temp schema is first */
+
processNamePattern(&buf, pattern, true, false,
NULL, "n.nspname", NULL,
NULL);
diff --git a/src/bin/psql/describe.h b/src/bin/psql/describe.h
index 195bf0e5578..8dcca759890 100644
--- a/src/bin/psql/describe.h
+++ b/src/bin/psql/describe.h
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/psql/describe.h,v 1.24 2004/06/18 06:14:04 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/describe.h,v 1.25 2004/07/13 16:48:16 momjian Exp $
*/
#ifndef DESCRIBE_H
#define DESCRIBE_H
@@ -56,7 +56,7 @@ bool listConversions(const char *pattern);
bool listCasts(const char *pattern);
/* \dn */
-bool listSchemas(const char *pattern);
+bool listSchemas(const char *pattern, bool verbose);
#endif /* DESCRIBE_H */
diff --git a/src/bin/psql/help.c b/src/bin/psql/help.c
index ed9574a2297..1fffbd25b4d 100644
--- a/src/bin/psql/help.c
+++ b/src/bin/psql/help.c
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/psql/help.c,v 1.88 2004/06/18 06:14:04 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/help.c,v 1.89 2004/07/13 16:48:16 momjian Exp $
*/
#include "postgres_fe.h"
#include "common.h"
@@ -218,7 +218,7 @@ slashUsage(unsigned short int pager)
fprintf(output, _(" \\dD [PATTERN] list domains\n"));
fprintf(output, _(" \\df [PATTERN] list functions (add \"+\" for more detail)\n"));
fprintf(output, _(" \\dg [PATTERN] list groups\n"));
- fprintf(output, _(" \\dn [PATTERN] list schemas\n"));
+ fprintf(output, _(" \\dn [PATTERN] list schemas (add \"+\" for more detail)\n"));
fprintf(output, _(" \\do [NAME] list operators\n"));
fprintf(output, _(" \\dl list large objects, same as \\lo_list\n"));
fprintf(output, _(" \\dp [PATTERN] list table, view and sequence access privileges\n"));