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

Re: system catalog privilege and create privilege ??? how to control them?? thanks

From: "Albe Laurenz" <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "leaf_yxj *EXTERN*" <leaf_yxj(at)163(dot)com>,<pgsql-general(at)postgresql(dot)org>
Subject: Re: system catalog privilege and create privilege ??? how to control them?? thanks
Date: 2012-03-29 08:16:23
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-general
leaf_yxj wrote:
> For oracle, the normal user can't see all the system catalog. but for
> postgresql, it looks like all the user can see the system catalog.
> we limit the user read privilege to system catalog?

You can try that, but things may break in unexpected ways.
For example, psql's utility commands will probably stop working.
I would test any such change thoroughly.

Not all system catalogs are visible for everybody, tables and views
containing passwords for example can only be read by superusers.

PostgreSQL has fewer restrictions on reading system catalogs than
I can see how a seasoned Oracle DBA might feel uneasy if everybody
can find out all user names on the database cluster.

> In oracle, the system privilege has create table, create view,create
> function.  For postgresql database, how to control the user who only
> create table but can't create view. Based on the test I did, once the
> has the create privilege on the schema, the user will have any create
> privilege on that schema. In postgresql, Rule is used to control that
> very confused!

PostgreSQL's permission system is different from Oracle's.
Oracle has a lot of "system privileges" which PostgreSQL does not
have or need.

In Oracle, every user automatically has a schema of the same name
and there are no permissions on schema basis.  So you need system
privileges if you want to keep users from creating objects.

In PostgreSQL you can use schema permissions.
True, as soon as you have CREATE on a schema, you can create any
kind of object there.  That is, any kind of object that does not
depend on anything else.
To create a function, you need the USAGE privilege on the
procedural function.  You can revoke this right from PUBLIC and
only give it to the users you want.
To create a trigger, you need the TRIGGER privilege on the
table involved and the EXECUTE privilege on the trigger function.

So you see, most of what Oracle handles with system privileges is
handled with object privileges in PostgreSQL.  And you usually
can assign permissions in a finer granularity that way.

Of course it is confusing at first, but once you understand
PostgreSQL's permission system, there are few meaningful things
that you cannot achieve with it.
What's the use case for granting somebody CREATE TABLE, but

Laurenz Albe

In response to


pgsql-general by date

Next:From: Albe LaurenzDate: 2012-03-29 08:24:28
Subject: Re: Query regarding submission on To Do item for psql client "psql : Allow processing of multiple -f (file) options "
Previous:From: Alban HertroysDate: 2012-03-29 08:13:17
Subject: Re: why is pg_dump so much smaller than my database?

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