Thread: Multiline privileges in \z

Multiline privileges in \z

From
"Brendan Jurd"
Date:
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