Re: psql schema permissions

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Dennis Bjorklund <db(at)zigo(dot)dhs(dot)org>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: psql schema permissions
Date: 2004-07-13 16:51:30
Message-ID: 200407131651.i6DGpUg11555@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Dennis Bjorklund wrote:
> There is no way to show schema permissions in psql.
>
> The alternatives are:
>
> 1) A new \dpn command
>
> 2) Extend \dp to also show rights for schemas, but then we need
> an extra column to describe what kind of object it is, and it
> would mess up the pattern stuff.
>
> 3) Do nothing and let people who want to see schema permissions
> query the system table (select * from pg_namespace).
>
> 4) Since \dn only shows the name and the owner we can simply
> add a permission column.
>
> 5) Some better way that is unknow to me
>
> I've attached a patch for number 4) which I think is the best. Well, 5) is
> better, but also harder to implement.

I have applied a modified version of your patch, attached. It makes
\dn+ show schema permissions and descriptions. (Idea from Tom.)

I don't think \dp makes sense because it is for data containers, not for
something like schemas. In fact the big issue is that \dp with no arg
would make no sense if it displayed schemas along with tables/sequences:

Access privileges for database "test"
Schema | Name | Type | Access privileges
--------+-------+-------+-------------------
public | test | table |
public | test2 | table |
public | test3 | table |
(3 rows)

It seems much more logical to add the info to \dn+:

test=> \dn
List of schemas
Name | Owner
--------------------+----------
information_schema | postgres
pg_catalog | postgres
pg_toast | postgres
public | postgres
(4 rows)

test=> \dn+
List of schemas
Name | Owner | Access privileges | Description
--------------------+----------+-------------------------------------+----------------------------------
information_schema | postgres | {postgres=UC/postgres,=U/postgres} |
pg_catalog | postgres | {postgres=UC/postgres,=U/postgres} | System catalog schema
pg_toast | postgres | | Reserved schema for TOAST tables
public | postgres | {postgres=UC/postgres,=UC/postgres} | I am public
(4 rows)

A little wide, but I don't see a better solution for this.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

Attachment Content-Type Size
unknown_filename text/plain 5.9 KB

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Magnus Hagander 2004-07-13 20:20:42 Re: [HACKERS] Is "trust" really a good default?
Previous Message Bruce Momjian 2004-07-13 16:48:16 pgsql-server: Have \dn+ show permissions and description for schemas.