Skip to content

Commit 3ceda5e

Browse files
committed
I just noticed that \dp outputs "Table" to indicate relations (tables,
sequences and views). This patch allows it to handle views and sequences. Euler Taveira de Oliveira
1 parent a7f0747 commit 3ceda5e

File tree

4 files changed

+16
-15
lines changed

4 files changed

+16
-15
lines changed

doc/src/sgml/ref/grant.sgml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/ref/grant.sgml,v 1.38 2003/11/29 19:51:39 pgsql Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/grant.sgml,v 1.39 2004/03/22 03:38:24 momjian Exp $
33
PostgreSQL documentation
44
-->
55

@@ -285,10 +285,10 @@ GRANT { { CREATE | USAGE } [,...] | ALL [ PRIVILEGES ] }
285285
<programlisting>
286286
=> \z mytable
287287

288-
Access privileges for database "lusitania"
289-
Schema | Table | Access privileges
290-
--------+---------+---------------------------------------
291-
public | mytable | {=r/postgres,miriam=arwdRxt/postgres,"group todos=arw/postgres"}
288+
Access privileges for database "lusitania"
289+
Schema | Name | Type | Access privileges
290+
--------+---------+-------+-----------------------------------------------------------------
291+
public | mytable | table | {=r/postgres,miriam=arwdRxt/postgres,"group todos=arw/postgres"}
292292
(1 row)
293293
</programlisting>
294294
The entries shown by <command>\z</command> are interpreted thus:

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

Lines changed: 5 additions & 5 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.106 2004/02/13 05:10:02 momjian Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.107 2004/03/22 03:38:24 momjian Exp $
33
PostgreSQL documentation
44
-->
55

@@ -995,10 +995,10 @@ testdb=>
995995
<term><literal>\dp</literal> [ <replaceable class="parameter">pattern</replaceable> ]</term>
996996
<listitem>
997997
<para>
998-
Produces a list of all available tables with their
998+
Produces a list of all available tables, views and sequences with their
999999
associated access privileges.
10001000
If <replaceable class="parameter">pattern</replaceable> is
1001-
specified, only tables whose names match the pattern are listed.
1001+
specified, only tables, views and sequences whose names match the pattern are listed.
10021002
</para>
10031003

10041004
<para>
@@ -1695,10 +1695,10 @@ lo_import 152801
16951695
<term><literal>\z</literal> [ <replaceable class="parameter">pattern</replaceable> ]</term>
16961696
<listitem>
16971697
<para>
1698-
Produces a list of all available tables with their
1698+
Produces a list of all available tables, views and sequences with their
16991699
associated access privileges.
17001700
If a <replaceable class="parameter">pattern</replaceable> is
1701-
specified, only tables whose names match the pattern are listed.
1701+
specified, only tables,views and sequences whose names match the pattern are listed.
17021702
</para>
17031703

17041704
<para>

src/bin/psql/describe.c

Lines changed: 3 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.c,v 1.94 2004/01/25 03:07:22 neilc Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.95 2004/03/22 03:38:24 momjian Exp $
77
*/
88
#include "postgres_fe.h"
99
#include "describe.h"
@@ -351,11 +351,12 @@ permissionsList(const char *pattern)
351351
printfPQExpBuffer(&buf,
352352
"SELECT n.nspname as \"%s\",\n"
353353
" c.relname as \"%s\",\n"
354+
" CASE c.relkind WHEN 'r' THEN '%s' WHEN 'v' THEN '%s' WHEN 'S' THEN '%s' END as \"%s\",\n"
354355
" c.relacl as \"%s\"\n"
355356
"FROM pg_catalog.pg_class c\n"
356357
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace\n"
357358
"WHERE c.relkind IN ('r', 'v', 'S')\n",
358-
_("Schema"), _("Table"), _("Access privileges"));
359+
_("Schema"), _("Name"), _("table"), _("view"), _("sequence"), _("Type"), _("Access privileges"));
359360

360361
/*
361362
* Unless a schema pattern is specified, we suppress system and temp

src/bin/psql/help.c

Lines changed: 3 additions & 3 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.85 2004/01/09 21:15:51 momjian Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/help.c,v 1.86 2004/03/22 03:38:24 momjian Exp $
77
*/
88
#include "postgres_fe.h"
99
#include "common.h"
@@ -220,11 +220,11 @@ slashUsage(unsigned short int pager)
220220
fprintf(output, _(" \\dn [PATTERN] list schemas\n"));
221221
fprintf(output, _(" \\do [NAME] list operators\n"));
222222
fprintf(output, _(" \\dl list large objects, same as \\lo_list\n"));
223-
fprintf(output, _(" \\dp [PATTERN] list table access privileges\n"));
223+
fprintf(output, _(" \\dp [PATTERN] list table, view and sequence access privileges\n"));
224224
fprintf(output, _(" \\dT [PATTERN] list data types (add \"+\" for more detail)\n"));
225225
fprintf(output, _(" \\du [PATTERN] list users\n"));
226226
fprintf(output, _(" \\l list all databases (add \"+\" for more detail)\n"));
227-
fprintf(output, _(" \\z [PATTERN] list table access privileges (same as \\dp)\n"));
227+
fprintf(output, _(" \\z [PATTERN] list table, view and sequence access privileges (same as \\dp)\n"));
228228
fprintf(output, "\n");
229229

230230
fprintf(output, _("Formatting\n"));

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy