hi all I am getting the error below after creating a policy on my table, the policy is --> columnname in(select samecolumnname from table where user=uid())
the idea is to only select rows for the users that are in the same company as the one logged in
"infinite recursion detected in policy for relation \"user_profile\""
b
burggraf
08/11/2021, 12:30 PM
Can you give a little more info about your problem? What does the relevant table look like? What are the fields?
d
dailylurker
08/11/2021, 1:46 PM
Hi, here are the details
user_profile:
id
company_id - related to companies
companies:
company_id
admin_id - related to user_profile
I am creating a policy so that the read will only be allowed if:
1. the current user is the admin of that company
2. if the user_profile row is in the same company as current user