Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 93a1fce

Browse files
committed
Add permission display to \db+.
1 parent a837ed8 commit 93a1fce

File tree

5 files changed

+20
-11
lines changed

5 files changed

+20
-11
lines changed

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

Lines changed: 3 additions & 1 deletion
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.118 2004/07/13 16:48:15 momjian Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.119 2004/07/15 03:56:04 momjian Exp $
33
PostgreSQL documentation
44
-->
55

@@ -832,6 +832,8 @@ testdb=>
832832
Lists all available tablespaces. If <replaceable
833833
class="parameter">pattern</replaceable>
834834
is specified, only tablespaces whose names match the pattern are shown.
835+
If <literal>+</literal> is appended to the command name, each object
836+
is listed with its associated permissions.
835837
</para>
836838
</listitem>
837839
</varlistentry>

src/bin/psql/command.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.121 2004/07/13 16:48:16 momjian Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.122 2004/07/15 03:56:06 momjian Exp $
77
*/
88
#include "postgres_fe.h"
99
#include "command.h"
@@ -302,7 +302,7 @@ exec_command(const char *cmd,
302302
success = describeAggregates(pattern, show_verbose);
303303
break;
304304
case 'b':
305-
success = describeTablespaces(pattern);
305+
success = describeTablespaces(pattern, show_verbose);
306306
break;
307307
case 'c':
308308
success = listConversions(pattern);

src/bin/psql/describe.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.102 2004/07/13 16:48:16 momjian Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.103 2004/07/15 03:56:06 momjian Exp $
77
*/
88
#include "postgres_fe.h"
99
#include "describe.h"
@@ -106,7 +106,7 @@ describeAggregates(const char *pattern, bool verbose)
106106
* Takes an optional regexp to select particular tablespaces
107107
*/
108108
bool
109-
describeTablespaces(const char *pattern)
109+
describeTablespaces(const char *pattern, bool verbose)
110110
{
111111
PQExpBufferData buf;
112112
PGresult *res;
@@ -117,10 +117,17 @@ describeTablespaces(const char *pattern)
117117
printfPQExpBuffer(&buf,
118118
"SELECT spcname AS \"%s\",\n"
119119
" pg_catalog.pg_get_userbyid(spcowner) AS \"%s\",\n"
120-
" spclocation AS \"%s\"\n"
121-
"FROM pg_catalog.pg_tablespace\n",
120+
" spclocation AS \"%s\"",
122121
_("Name"), _("Owner"), _("Location"));
123122

123+
if (verbose)
124+
appendPQExpBuffer(&buf,
125+
",\n spcacl as \"%s\"",
126+
_("Access privileges"));
127+
128+
appendPQExpBuffer(&buf,
129+
"\nFROM pg_catalog.pg_tablespace\n");
130+
124131
processNamePattern(&buf, pattern, false, false,
125132
NULL, "spcname", NULL,
126133
NULL);

src/bin/psql/describe.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/describe.h,v 1.25 2004/07/13 16:48:16 momjian Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/describe.h,v 1.26 2004/07/15 03:56:06 momjian Exp $
77
*/
88
#ifndef DESCRIBE_H
99
#define DESCRIBE_H
@@ -14,7 +14,7 @@
1414
bool describeAggregates(const char *pattern, bool verbose);
1515

1616
/* \db */
17-
bool describeTablespaces(const char *pattern);
17+
bool describeTablespaces(const char *pattern, bool verbose);
1818

1919
/* \df */
2020
bool describeFunctions(const char *pattern, bool verbose);

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-2003, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/help.c,v 1.89 2004/07/13 16:48:16 momjian Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/help.c,v 1.90 2004/07/15 03:56:06 momjian Exp $
77
*/
88
#include "postgres_fe.h"
99
#include "common.h"
@@ -211,7 +211,7 @@ slashUsage(unsigned short int pager)
211211
fprintf(output, _(" \\d{t|i|s|v|S} [PATTERN] (add \"+\" for more detail)\n"
212212
" list tables/indexes/sequences/views/system tables\n"));
213213
fprintf(output, _(" \\da [PATTERN] list aggregate functions\n"));
214-
fprintf(output, _(" \\db [PATTERN] list tablespaces\n"));
214+
fprintf(output, _(" \\db [PATTERN] list tablespaces (add \"+\" for more detail)\n"));
215215
fprintf(output, _(" \\dc [PATTERN] list conversions\n"));
216216
fprintf(output, _(" \\dC list casts\n"));
217217
fprintf(output, _(" \\dd [PATTERN] show comment for object\n"));

0 commit comments

Comments
 (0)