Skip site navigation (1) Skip section navigation (2)

Multiline privileges in \z

From: "Brendan Jurd" <direvus(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org, pgsql-patches(at)postgresql(dot)org
Subject: Multiline privileges in \z
Date: 2008-04-17 16:21:36
Message-ID: 37ed240d0804170921h7a6b92fev65aeb99f658f8f21@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-patches
Hi hackers,

It occurred to me that psql's \z command could benefit from the
addition of some newlines.  With any more than one grantee per object,
the output of \z rapidly becomes extremely wide, and very hard to
read.

I'd like to split the output onto one line per grantee.  So, instead of this:

 Schema | Name | Type  |                            Access privileges
--------+------+-------+-------------------------------------------------------------------------
 public | a    | table |
{brendanjurd=arwdxt/brendanjurd,foo=arwd/brendanjurd,bar=r/brendanjurd}
 public | b    | table | {brendanjurd=arwdxt/brendanjurd,foo=arwd/brendanjurd}
(2 rows)

You would get this:

 Schema | Name | Type  |       Access privileges
--------+------+-------+--------------------------------
 public | a    | table | brendanjurd=arwdxt/brendanjurd
                       : foo=arwd/brendanjurd
                       : bar=r/brendanjurd
 public | b    | table | brendanjurd=arwdxt/brendanjurd
                       : foo=arwd/brendanjurd
(2 rows)

Because the -----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

ACLs
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: http://getfiregpg.org

iD8DBQFIB3kL5YBsbHkuyV0RAgWQAJ9bcl3bOFozvi9LxRAQN1OwT3t+QgCcCGVq
dcMw3wIBQVPv1nYDBCSRpDA=
=s1eD
-----END PGP SIGNATURE-----
 are stored as an array, the patch to achieve this is trivial (see attached).

Looking forward to your comments.

Added to wiki.

Cheers,
BJ

Attachment: multiline-privs_0.diff
Description: text/plain (3.1 KB)

Responses

pgsql-hackers by date

Next:From: Tom LaneDate: 2008-04-17 16:34:31
Subject: Plan targetlists in EXPLAIN output
Previous:From: Tom LaneDate: 2008-04-17 16:14:50
Subject: Re: new field content lost

pgsql-patches by date

Next:From: Tom LaneDate: 2008-04-17 16:37:30
Subject: Re: [HACKERS] Multiline privileges in \z
Previous:From: Tom LaneDate: 2008-04-17 15:52:02
Subject: Re: Patch for Prevent pg_dump/pg_restore from being affected by statement_timeout

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group