mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-10-02 22:16:48 +02:00
Have \dn+ show permissions and description for schemas.
Dennis Bjorklund
This commit is contained in:
parent
dc0e76ca36
commit
bbcee544aa
@ -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
|
PostgreSQL documentation
|
||||||
-->
|
-->
|
||||||
|
|
||||||
@ -990,7 +990,9 @@ testdb=>
|
|||||||
Lists all available schemas (namespaces). If <replaceable
|
Lists all available schemas (namespaces). If <replaceable
|
||||||
class="parameter">pattern</replaceable> (a regular expression)
|
class="parameter">pattern</replaceable> (a regular expression)
|
||||||
is specified, only schemas whose names match the pattern are listed.
|
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>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
|
* 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 "postgres_fe.h"
|
||||||
#include "command.h"
|
#include "command.h"
|
||||||
@ -326,7 +326,7 @@ exec_command(const char *cmd,
|
|||||||
success = do_lo_list();
|
success = do_lo_list();
|
||||||
break;
|
break;
|
||||||
case 'n':
|
case 'n':
|
||||||
success = listSchemas(pattern);
|
success = listSchemas(pattern, show_verbose);
|
||||||
break;
|
break;
|
||||||
case 'o':
|
case 'o':
|
||||||
success = describeOperators(pattern);
|
success = describeOperators(pattern);
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
|
* 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 "postgres_fe.h"
|
||||||
#include "describe.h"
|
#include "describe.h"
|
||||||
@ -1693,7 +1693,7 @@ listCasts(const char *pattern)
|
|||||||
* Describes schemas (namespaces)
|
* Describes schemas (namespaces)
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
listSchemas(const char *pattern)
|
listSchemas(const char *pattern, bool verbose)
|
||||||
{
|
{
|
||||||
PQExpBufferData buf;
|
PQExpBufferData buf;
|
||||||
PGresult *res;
|
PGresult *res;
|
||||||
@ -1702,13 +1702,21 @@ listSchemas(const char *pattern)
|
|||||||
initPQExpBuffer(&buf);
|
initPQExpBuffer(&buf);
|
||||||
printfPQExpBuffer(&buf,
|
printfPQExpBuffer(&buf,
|
||||||
"SELECT n.nspname AS \"%s\",\n"
|
"SELECT n.nspname AS \"%s\",\n"
|
||||||
" u.usename AS \"%s\"\n"
|
" u.usename AS \"%s\"",
|
||||||
"FROM pg_catalog.pg_namespace n LEFT JOIN pg_catalog.pg_user u\n"
|
_("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"
|
" ON n.nspowner=u.usesysid\n"
|
||||||
"WHERE (n.nspname NOT LIKE 'pg\\\\_temp\\\\_%%' OR\n"
|
"WHERE (n.nspname NOT LIKE 'pg\\\\_temp\\\\_%%' OR\n"
|
||||||
" n.nspname = (pg_catalog.current_schemas(true))[1])\n", /* temp schema is first */
|
" n.nspname = (pg_catalog.current_schemas(true))[1])\n"); /* temp schema is first */
|
||||||
_("Name"),
|
|
||||||
_("Owner"));
|
|
||||||
processNamePattern(&buf, pattern, true, false,
|
processNamePattern(&buf, pattern, true, false,
|
||||||
NULL, "n.nspname", NULL,
|
NULL, "n.nspname", NULL,
|
||||||
NULL);
|
NULL);
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
|
* 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
|
#ifndef DESCRIBE_H
|
||||||
#define DESCRIBE_H
|
#define DESCRIBE_H
|
||||||
@ -56,7 +56,7 @@ bool listConversions(const char *pattern);
|
|||||||
bool listCasts(const char *pattern);
|
bool listCasts(const char *pattern);
|
||||||
|
|
||||||
/* \dn */
|
/* \dn */
|
||||||
bool listSchemas(const char *pattern);
|
bool listSchemas(const char *pattern, bool verbose);
|
||||||
|
|
||||||
|
|
||||||
#endif /* DESCRIBE_H */
|
#endif /* DESCRIBE_H */
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
|
* 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 "postgres_fe.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
@ -218,7 +218,7 @@ slashUsage(unsigned short int pager)
|
|||||||
fprintf(output, _(" \\dD [PATTERN] list domains\n"));
|
fprintf(output, _(" \\dD [PATTERN] list domains\n"));
|
||||||
fprintf(output, _(" \\df [PATTERN] list functions (add \"+\" for more detail)\n"));
|
fprintf(output, _(" \\df [PATTERN] list functions (add \"+\" for more detail)\n"));
|
||||||
fprintf(output, _(" \\dg [PATTERN] list groups\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, _(" \\do [NAME] list operators\n"));
|
||||||
fprintf(output, _(" \\dl list large objects, same as \\lo_list\n"));
|
fprintf(output, _(" \\dl list large objects, same as \\lo_list\n"));
|
||||||
fprintf(output, _(" \\dp [PATTERN] list table, view and sequence access privileges\n"));
|
fprintf(output, _(" \\dp [PATTERN] list table, view and sequence access privileges\n"));
|
||||||
|
Loading…
Reference in New Issue
Block a user