Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbbcee54

Browse files
committed
Have \dn+ show permissions and description for schemas.
Dennis Bjorklund
1 parentdc0e76c commitbbcee54

File tree

5 files changed

+25
-15
lines changed

5 files changed

+25
-15
lines changed

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

Lines changed: 4 additions & 2 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.117 2004/07/12 20:41:08 momjian Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.118 2004/07/13 16:48:15 momjian Exp $
33
PostgreSQL documentation
44
-->
55

@@ -990,7 +990,9 @@ testdb=>
990990
Lists all available schemas (namespaces). If <replaceable
991991
class="parameter">pattern</replaceable> (a regular expression)
992992
is specified, only schemas whose names match the pattern are listed.
993-
Non-local temporary schemas are suppressed.
993+
Non-local temporary schemas are suppressed. If <literal>+</literal>
994+
is appended to the command name, each object is listed with its associated
995+
permissions and description, if any.
994996
</para>
995997
</listitem>
996998
</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.120 2004/07/11 21:34:03 momjian Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.121 2004/07/13 16:48:16 momjian Exp $
77
*/
88
#include"postgres_fe.h"
99
#include"command.h"
@@ -326,7 +326,7 @@ exec_command(const char *cmd,
326326
success=do_lo_list();
327327
break;
328328
case'n':
329-
success=listSchemas(pattern);
329+
success=listSchemas(pattern,show_verbose);
330330
break;
331331
case'o':
332332
success=describeOperators(pattern);

‎src/bin/psql/describe.c

Lines changed: 15 additions & 7 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.101 2004/07/1302:46:21 momjian Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.102 2004/07/1316:48:16 momjian Exp $
77
*/
88
#include"postgres_fe.h"
99
#include"describe.h"
@@ -1693,7 +1693,7 @@ listCasts(const char *pattern)
16931693
* Describes schemas (namespaces)
16941694
*/
16951695
bool
1696-
listSchemas(constchar*pattern)
1696+
listSchemas(constchar*pattern,boolverbose)
16971697
{
16981698
PQExpBufferDatabuf;
16991699
PGresult*res;
@@ -1702,13 +1702,21 @@ listSchemas(const char *pattern)
17021702
initPQExpBuffer(&buf);
17031703
printfPQExpBuffer(&buf,
17041704
"SELECT n.nspname AS \"%s\",\n"
1705-
" u.usename AS \"%s\"\n"
1706-
"FROM pg_catalog.pg_namespace n LEFT JOIN pg_catalog.pg_user u\n"
1705+
" u.usename AS \"%s\"",
1706+
_("Name"),_("Owner"));
1707+
1708+
if (verbose)
1709+
appendPQExpBuffer(&buf,
1710+
",\n n.nspacl as \"%s\","
1711+
" pg_catalog.obj_description(n.oid, 'pg_namespace') as \"%s\"",
1712+
_("Access privileges"),_("Description"));
1713+
1714+
appendPQExpBuffer(&buf,
1715+
"\nFROM pg_catalog.pg_namespace n LEFT JOIN pg_catalog.pg_user u\n"
17071716
" ON n.nspowner=u.usesysid\n"
17081717
"WHERE(n.nspname NOT LIKE 'pg\\\\_temp\\\\_%%' OR\n"
1709-
" n.nspname = (pg_catalog.current_schemas(true))[1])\n",/* temp schema is first */
1710-
_("Name"),
1711-
_("Owner"));
1718+
" n.nspname = (pg_catalog.current_schemas(true))[1])\n");/* temp schema is first */
1719+
17121720
processNamePattern(&buf,pattern, true, false,
17131721
NULL,"n.nspname",NULL,
17141722
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.24 2004/06/18 06:14:04 tgl Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/describe.h,v 1.25 2004/07/13 16:48:16 momjian Exp $
77
*/
88
#ifndefDESCRIBE_H
99
#defineDESCRIBE_H
@@ -56,7 +56,7 @@ boollistConversions(const char *pattern);
5656
boollistCasts(constchar*pattern);
5757

5858
/* \dn */
59-
boollistSchemas(constchar*pattern);
59+
boollistSchemas(constchar*pattern,boolverbose);
6060

6161

6262
#endif/* DESCRIBE_H */

‎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.88 2004/06/18 06:14:04 tgl Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/help.c,v 1.89 2004/07/13 16:48:16 momjian Exp $
77
*/
88
#include"postgres_fe.h"
99
#include"common.h"
@@ -218,7 +218,7 @@ slashUsage(unsigned short int pager)
218218
fprintf(output,_(" \\dD [PATTERN] list domains\n"));
219219
fprintf(output,_(" \\df [PATTERN] list functions (add \"+\" for more detail)\n"));
220220
fprintf(output,_(" \\dg [PATTERN] list groups\n"));
221-
fprintf(output,_(" \\dn [PATTERN] list schemas\n"));
221+
fprintf(output,_(" \\dn [PATTERN] list schemas (add \"+\" for more detail)\n"));
222222
fprintf(output,_(" \\do [NAME] list operators\n"));
223223
fprintf(output,_(" \\dl list large objects, same as \\lo_list\n"));
224224
fprintf(output,_(" \\dp [PATTERN] list table, view and sequence access privileges\n"));

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp