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

[HACHERS] privilege check: column level only?

From: "Golden Liu" <goldenliu(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: [HACHERS] privilege check: column level only?
Date: 2007-06-05 04:39:35
Message-ID: 2d3034200706042139sb7d620bja9a9b9243cb91c28@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-hackers
Hello

I'm one of the Google SoC's students for PostgreSQL. While reading sql92
standard, I found something like this:

11.36  <grant statement>
         General Rules
         3) For every identified privilege descriptor whose action is
            SELECT, INSERT, UPDATE, or REFERENCES without a column name,
            privilege descriptors are also created for each column C in O
            for which A holds the corresponding privilege with grant op-
            tion. For each such column, a privilege descriptor is created
            that specifies the identical <grantee>, the identical <action>,
            object C, and grantor A.

According to this, column privilege descriptors are created automatically
while table privilege descriptor is created. Then, while checking privilege,
can I JUST check column level privilege?

Here is some examples.

(1)
       CREATE TABLE t1 (c1 int, c2 int);
       GRANT SELECT ON t1 TO grantee;
       REVOKE SELECT ON t1 (c1) FROM grantee;
   Now grantee has privilege on t1(c2) but NOT on t1(c1). Although grantee
has privilege on t1, he still has no privilege on t1(c1). So checking column
privilege is enough. We don't need to check table privilege.
(2)
       CREATE TABLE t1 (c1 int, c2 int);
       REVOKE SELECT ON t1 FROM grantee;
       GRANT SELECT ON t1(c2) TO grantee;
   Here, still, grantee has privilege on t1(c2) but NOT on t1(c1). (Is this
right?) Although grantee has no privilege on t1, he can has privilege on
t1(c1). Here, again, checking column privilege is enough.

Table privilege is useful when you add columns to a table. Whether grantee
has privilege on the new columns depends on whether he has privilege on the
table.

Any and all help and/or comment is appreciated. From sql standard, I found
no information on how privilege check should be done.

Thanks.
Dong

-- 
Guodong Liu
Database Lab, School of EECS, Peking University
Room 314, Building 42, Peking University, Beijing, 100871, China

Responses

pgsql-hackers by date

Next:From: Devrim GÜNDÜZDate: 2007-06-05 07:28:58
Subject: How do we create the releases?
Previous:From: Jaime CasanovaDate: 2007-06-05 04:33:23
Subject: Re: [COMMITTERS] pgsql: Create a GUC parametertemp_tablespacesthatallows selection of

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