Add permission display to \db+.
authorBruce Momjian
Thu, 15 Jul 2004 03:56:06 +0000 (03:56 +0000)
committerBruce Momjian
Thu, 15 Jul 2004 03:56:06 +0000 (03:56 +0000)
doc/src/sgml/ref/psql-ref.sgml
src/bin/psql/command.c
src/bin/psql/describe.c
src/bin/psql/describe.h
src/bin/psql/help.c

index 37c73e2281718fc62afcf8c0efcb5bcbdfc6aeb3..497c6885aa5d3558eb020e3b692c4f8a7f461540 100644 (file)
@@ -1,5 +1,5 @@
 
 
@@ -832,6 +832,8 @@ testdb=>
         Lists all available tablespaces. If 
         class="parameter">pattern
         is specified, only tablespaces whose names match the pattern are shown.
+        If + is appended to the command name, each object 
+        is listed with its associated permissions.
         
         
       
index 222d761163f2401fab86cfad2c8522ae3a0f26dd..da2ab92b353dc1f4d527a2c4aadb9e970e7d2b87 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 2000-2003, PostgreSQL Global Development Group
  *
- * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.121 2004/07/13 16:48:16 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.122 2004/07/15 03:56:06 momjian Exp $
  */
 #include "postgres_fe.h"
 #include "command.h"
@@ -302,7 +302,7 @@ exec_command(const char *cmd,
                success = describeAggregates(pattern, show_verbose);
                break;
            case 'b':
-               success = describeTablespaces(pattern);
+               success = describeTablespaces(pattern, show_verbose);
                break;
            case 'c':
                success = listConversions(pattern);
index 432063640dbb8a15647243044090297d2e61fd85..328a1c079f1ca043ae96de8788572b96e0915689 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 2000-2003, PostgreSQL Global Development Group
  *
- * $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.102 2004/07/13 16:48:16 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.103 2004/07/15 03:56:06 momjian Exp $
  */
 #include "postgres_fe.h"
 #include "describe.h"
@@ -106,7 +106,7 @@ describeAggregates(const char *pattern, bool verbose)
  * Takes an optional regexp to select particular tablespaces
  */
 bool
-describeTablespaces(const char *pattern)
+describeTablespaces(const char *pattern, bool verbose)
 {
    PQExpBufferData buf;
    PGresult   *res;
@@ -117,10 +117,17 @@ describeTablespaces(const char *pattern)
    printfPQExpBuffer(&buf,
                      "SELECT spcname AS \"%s\",\n"
                      "  pg_catalog.pg_get_userbyid(spcowner) AS \"%s\",\n"
-                     "  spclocation AS \"%s\"\n"
-                     "FROM pg_catalog.pg_tablespace\n",
+                     "  spclocation AS \"%s\"",
                      _("Name"), _("Owner"), _("Location"));
 
+   if (verbose)
+       appendPQExpBuffer(&buf,
+           ",\n  spcacl as \"%s\"",
+           _("Access privileges"));
+                         
+   appendPQExpBuffer(&buf,
+                     "\nFROM pg_catalog.pg_tablespace\n");
+
    processNamePattern(&buf, pattern, false, false,
                       NULL, "spcname", NULL,
                       NULL);
index 8dcca7598901678a976a25047e0584043c7cd060..39b9563fe0a52e64eb5424c2a2a68d9d60ab6f57 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 2000-2003, PostgreSQL Global Development Group
  *
- * $PostgreSQL: pgsql/src/bin/psql/describe.h,v 1.25 2004/07/13 16:48:16 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/describe.h,v 1.26 2004/07/15 03:56:06 momjian Exp $
  */
 #ifndef DESCRIBE_H
 #define DESCRIBE_H
@@ -14,7 +14,7 @@
 bool       describeAggregates(const char *pattern, bool verbose);
 
 /* \db */
-bool       describeTablespaces(const char *pattern);
+bool       describeTablespaces(const char *pattern, bool verbose);
 
 /* \df */
 bool       describeFunctions(const char *pattern, bool verbose);
index 1fffbd25b4d5e4600e33e0f257cc2293718b54a9..f55ee7a0b0b7f2dcbb00cca24b124a63af68c4ce 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 2000-2003, PostgreSQL Global Development Group
  *
- * $PostgreSQL: pgsql/src/bin/psql/help.c,v 1.89 2004/07/13 16:48:16 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/help.c,v 1.90 2004/07/15 03:56:06 momjian Exp $
  */
 #include "postgres_fe.h"
 #include "common.h"
@@ -211,7 +211,7 @@ slashUsage(unsigned short int pager)
    fprintf(output, _("  \\d{t|i|s|v|S} [PATTERN] (add \"+\" for more detail)\n"
                      "                 list tables/indexes/sequences/views/system tables\n"));
    fprintf(output, _("  \\da [PATTERN]  list aggregate functions\n"));
-   fprintf(output, _("  \\db [PATTERN]  list tablespaces\n"));
+   fprintf(output, _("  \\db [PATTERN]  list tablespaces (add \"+\" for more detail)\n"));
    fprintf(output, _("  \\dc [PATTERN]  list conversions\n"));
    fprintf(output, _("  \\dC            list casts\n"));
    fprintf(output, _("  \\dd [PATTERN]  show comment for object\n"));