Im using a Greenploum database but im assuming its more or less the same as Postgres. I want to implement a row level security policy based on the value of a column which the table is partitioned by.
I have a table. TABLE rank (id int, rank int, year int, gender char(1), count int, source_system text)
example data:
(1,2, 2012, 1,1, source_system_a),
(2,1, 2012, 1,1, source_system_b),
(3,4, 2012, 1,1, source_system_a),
(4,3, 2012, 1,1, source_system_c),
The table is partitioned based on the source_system column. I want to have a set of users that can see all the data and a set of users that cannot see everything based on the source_system column. source_system_a should be a secure value therefore only those with secure permission should be able to see the row with source_system_a.
for instance,
user a (can see all) does 'select * from rank;'
result:
1,2, 2012, 1,1, source_system_a,
2,1, 2012, 1,1, source_system_b,
3,4, 2012, 1,1, source_system_a,
4,3, 2012, 1,1, source_system_c,
user b (not secure) does 'select * from rank;'
result:
2,1, 2012, 1,1, source_system_b,
4,3, 2012, 1,1, source_system_c,
Many Thanks