0

Is it possible to prevent the update/delete of a row in a table to a specific role depending on a value of the row?

This role should be able to query rows using select.

Example: Saying that we have an user bob and admin.

  • flag = 0, bob should be able to update/delete the row
  • flag = 1, bob can not update or delete the row, but bob can select the row
  • flag = 0 or flag = 1, admin can update or delete the row, regardless of the value in flag

I checked RLS(Row Level Security) but I don't know how to do that.

Thank you

Kumzy
  • 77
  • 1
  • 5
  • i hope this question can help you https://stackoverflow.com/questions/51400905/row-level-security-for-groups-or-making-rows-accebile-to-groups you can creat a group of people who can edit, and another who cant. Then create the `POLICY` similar to that in the question in above link. Then activate row level security on that table as in the above question. This will make the RLS to work on the basis of defined policy. – khaldi Sep 26 '18 at 09:55
  • in the `Policy` replace 'FOR ALL' with `FOR UPDATE, DELETE' – khaldi Sep 26 '18 at 09:59

0 Answers0