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
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-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 Content-Type Size
multiline-privs_0.diff text/plain 3.1 KB

Responses

Browse pgsql-hackers by date

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

Browse pgsql-patches by date

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