pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Collumn level permissions ?
3+ messages / 3 participants
[nested] [flat]

* Collumn level permissions ?
@ 2019-08-19 19:17  stan <stanb@panix.com>
  0 siblings, 2 replies; 3+ messages in thread

From: stan @ 2019-08-19 19:17 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

I do know a way to solve this. I could create a view "B" that is a view of
tab;e "A" without column "C" on the select, and give a user permissions on
B, but not on A, or at least I think that would work.

What I specifically need to do is "hide" one column of a table from a set
of users.

Any better way to do this?


-- 
"They that would give up essential liberty for temporary safety deserve
neither liberty nor safety."
						-- Benjamin Franklin





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Collumn level permissions ?
@ 2019-08-19 19:24  Adrian Klaver <adrian.klaver@aklaver.com>
  parent: stan <stanb@panix.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Adrian Klaver @ 2019-08-19 19:24 UTC (permalink / raw)
  To: stan <stanb@panix.com>; pgsql-general@lists.postgresql.org

On 8/19/19 12:17 PM, stan wrote:
> I do know a way to solve this. I could create a view "B" that is a view of
> tab;e "A" without column "C" on the select, and give a user permissions on
> B, but not on A, or at least I think that would work.
> 
> What I specifically need to do is "hide" one column of a table from a set
> of users.
> 
> Any better way to do this?

https://www.postgresql.org/docs/11/sql-grant.html

> 
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Collumn level permissions ?
@ 2019-08-20 08:29  Laurenz Albe <laurenz.albe@cybertec.at>
  parent: stan <stanb@panix.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Laurenz Albe @ 2019-08-20 08:29 UTC (permalink / raw)
  To: stan <stanb@panix.com>; pgsql-general@lists.postgresql.org

stan wrote:
> I do know a way to solve this. I could create a view "B" that is a
> view of
> tab;e "A" without column "C" on the select, and give a user
> permissions on
> B, but not on A, or at least I think that would work.
> 
> What I specifically need to do is "hide" one column of a table from a
> set
> of users.
> 
> Any better way to do this?

You can use column permissions:

REVOKE SELECT ON mytable FROM auser;
GRANT SELECT (col1, col2) ON mytable TO auser;

This will cause any query that tries to read any other
column to fail with an error.

If you don't like that, your technique is good, but don't
forget to add "WITH (security_barrier = true)" so that nobody
can subvert security.

Yours,
Laurenz Albe
-- 
+43-670-6056265
Cybertec Schönig & Schönig GmbH
Gröhrmühlgasse 26, A-2700 Wiener Neustadt
Web: https://www.cybertec-postgresql.com






^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2019-08-20 08:29 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-08-19 19:17 Collumn level permissions ? stan <stanb@panix.com>
2019-08-19 19:24 ` Adrian Klaver <adrian.klaver@aklaver.com>
2019-08-20 08:29 ` Laurenz Albe <laurenz.albe@cybertec.at>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox