Reputation: 21
Example: I have a basetable "wishfulthinking" with columns - a, b, c I have user1, user2, user 3 [Note: user is also a role, meaning, user1 is role1 and user2 is role2...]
I would like to give all the above users access to all the tables (a,b,c) BUT, user1 - should only be able to view a,b columns user2 - should be able to view b,c columns and user3 - should be able view a,c columns
What I have tried so far: Materialised View: Created a view with only a,b columns and gave SELECT privilege to user1/role1. login as user1 and try to select, i get the error - User user1 has no SELECT permission on table keyspace.wishfulthinking.
Now, when I give user1/role1 access to base table(wishfulthinking), the user will be able to get all the 3 columns instead of 2.
What am I missing here? Is it even possible or it wishful thinking? Any help will be much appreciated.
Upvotes: 1
Views: 200
Reputation: 2104
You should not use materialized views.
I would duplicate the table without the columns that the second user should not see and set select permissions on table1 for user1 and table2 for user2.
Upvotes: 1