RLS for Columns?
I'm currently working on a project involving the quizzes and likes tables in our database, and I could use your expertise to address a specific challenge.
The Goal:
I aim to implement a function trigger that updates the quizzes table's likes column whenever a row is inserted or deleted in the likes table. However, there's a hurdle due to the Row-Level Security (RLS) policy applied to the quizzes table. This policy restricts the function from updating the likes or dislikes columns unless the user triggering the update is the owner of the quiz.
Challenge:
Any solutions to enable this functionality, allowing any user to update the likes count for quizzes regardless of the user's ownership. Any insights into potential workarounds or adjustments would be greatly appreciated.
Relevant Information:
The quizzes table is as follows:
RLS for quizzes table:
The likes Table is as follows:
The Goal:
I aim to implement a function trigger that updates the quizzes table's likes column whenever a row is inserted or deleted in the likes table. However, there's a hurdle due to the Row-Level Security (RLS) policy applied to the quizzes table. This policy restricts the function from updating the likes or dislikes columns unless the user triggering the update is the owner of the quiz.
Challenge:
Any solutions to enable this functionality, allowing any user to update the likes count for quizzes regardless of the user's ownership. Any insights into potential workarounds or adjustments would be greatly appreciated.
Relevant Information:
The quizzes table is as follows:
RLS for quizzes table:
The likes Table is as follows: