Multiline privileges in \z - Mailing list pgsql-hackers

From Brendan Jurd
Subject Multiline privileges in \z
Date
Msg-id 37ed240d0804170921h7a6b92fev65aeb99f658f8f21@mail.gmail.com
Whole thread Raw
List pgsql-hackers
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

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: new field content lost
Next
From: Tom Lane
Date:
Subject: Plan targetlists in EXPLAIN output