Re: Grant column level permissions

From: Michał Pawlikowski <misiekbest(at)gmail(dot)com>
To: dipti shah <shahdipti1980(at)gmail(dot)com>
Cc: Michael Glaesemann <grzm(at)seespotcode(dot)net>, pgsql-general(at)postgresql(dot)org
Subject: Re: Grant column level permissions
Date: 2010-04-08 11:48:32
Message-ID: w2v217ea9ed1004080448qfd73dee1xde79863bedb86ebe@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Apr 8, 2010 at 1:41 PM, dipti shah <shahdipti1980(at)gmail(dot)com> wrote:
> Okay. I think I got it but it is not working the way it should. I have given
> select permission on one column but still it is displaying both the columns.
> Could you please tell me what is wrong.
>
>
> techdb=# GRANT SELECT (description), UPDATE (description) ON techtable TO
> user1;
> GRANT
> sysdb=> select * from techtable;
>  number | description
> --------+-------------
> (0 rows)
>
> techdb=>
>
> Thanks.

test=# CREATE USER user1 ENCRYPTED PASSWORD 'test';
CREATE ROLE
test=# CREATE TABLE t1 (col1 int, col2 int);
CREATE TABLE

test=# REVOKE ALL ON t1 FROM user1 ;
REVOKE

test=# GRANT SELECT (col1) ON t1 TO user1;
GRANT

test=# \c test user1
You are now connected to database "test" as user "user1".

test=> select col1 from t1;
col1
------
(0 rows)

test=> select col2 from t1;
ERROR: permission denied for relation t1

--
Pozdrawiam / Best Regards / Mit freundlichen Grüßen
Michal Pawlikowski
XMPP: misiekbest(at)gmail(dot)com
FB: http://tinyurl.com/fbmbst
MS: http://myspace.com/mpawlikowski

In response to

Browse pgsql-general by date

  From Date Subject
Next Message dipti shah 2010-04-08 11:52:45 Re: Grant column level permissions
Previous Message dipti shah 2010-04-08 11:41:27 Re: Grant column level permissions