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

Commit a87f15d

Browse files
committed
Display ACLS using multiple lines for psql's \z. Brendan Jurd.
1 parent c0b1b01 commit a87f15d

File tree

3 files changed

+19
-15
lines changed

3 files changed

+19
-15
lines changed

doc/src/sgml/ref/grant.sgml

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/ref/grant.sgml,v 1.67 2007/10/30 19:43:30 tgl Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/grant.sgml,v 1.68 2008/05/05 01:21:03 adunstan Exp $
33
PostgreSQL documentation
44
-->
55

@@ -405,10 +405,12 @@ GRANT <replaceable class="PARAMETER">role</replaceable> [, ...] TO <replaceable
405405
to obtain information about existing privileges, for example:
406406
<programlisting>
407407
=&gt; \z mytable
408-
Access privileges for database "lusitania"
409-
Schema | Name | Type | Access privileges
410-
--------+---------+-------+---------------------------------------------------
411-
public | mytable | table | {miriam=arwdxt/miriam,=r/miriam,admin=arw/miriam}
408+
Access privileges for database "lusitania"
409+
Schema | Name | Type | Access privileges
410+
--------+---------+-------+----------------------
411+
public | mytable | table | miriam=arwdxt/miriam
412+
: =r/miriam
413+
: admin=arw/miriam
412414
(1 row)
413415
</programlisting>
414416
The entries shown by <command>\z</command> are interpreted thus:

src/bin/psql/describe.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2008, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.169 2008/05/05 00:11:31 adunstan Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.170 2008/05/05 01:21:03 adunstan Exp $
77
*/
88
#include "postgres_fe.h"
99
#include "describe.h"
@@ -493,7 +493,7 @@ permissionsList(const char *pattern)
493493
"SELECT n.nspname as \"%s\",\n"
494494
" c.relname as \"%s\",\n"
495495
" CASE c.relkind WHEN 'r' THEN '%s' WHEN 'v' THEN '%s' WHEN 'S' THEN '%s' END as \"%s\",\n"
496-
" c.relacl as \"%s\"\n"
496+
" pg_catalog.array_to_string(c.relacl, E'\\n') as \"%s\"\n"
497497
"FROM pg_catalog.pg_class c\n"
498498
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace\n"
499499
"WHERE c.relkind IN ('r', 'v', 'S')\n",

src/test/regress/expected/dependency.out

+10-8
Original file line numberDiff line numberDiff line change
@@ -68,19 +68,21 @@ NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "deptest_pkey" fo
6868
GRANT ALL ON deptest1 TO regression_user2;
6969
RESET SESSION AUTHORIZATION;
7070
\z deptest1
71-
Access privileges for database "regression"
72-
Schema | Name | Type | Access privileges
73-
--------+----------+-------+------------------------------------------------------------------------------------------------------------------------------------
74-
public | deptest1 | table | {regression_user0=arwdxt/regression_user0,regression_user1=a*r*w*d*x*t*/regression_user0,regression_user2=arwdxt/regression_user1}
71+
Access privileges for database "regression"
72+
Schema | Name | Type | Access privileges
73+
--------+----------+-------+------------------------------------------------
74+
public | deptest1 | table | regression_user0=arwdxt/regression_user0
75+
: regression_user1=a*r*w*d*x*t*/regression_user0
76+
: regression_user2=arwdxt/regression_user1
7577
(1 row)
7678

7779
DROP OWNED BY regression_user1;
7880
-- all grants revoked
7981
\z deptest1
80-
Access privileges for database "regression"
81-
Schema | Name | Type | Access privileges
82-
--------+----------+-------+--------------------------------------------
83-
public | deptest1 | table | {regression_user0=arwdxt/regression_user0}
82+
Access privileges for database "regression"
83+
Schema | Name | Type | Access privileges
84+
--------+----------+-------+------------------------------------------
85+
public | deptest1 | table | regression_user0=arwdxt/regression_user0
8486
(1 row)
8587

8688
-- table was dropped

0 commit comments

Comments
 (0)