Lior539
06/17/2022, 1:14 PMusers table. A user has an id field (foreign key on auth.oid()) and also a company_id
I want to write a RLP such that a user can select the row for any other user provided they are in the same company (i.e have the same company_id)
I wrote the following statement, but the problem is that I get an infinite recursion error (which makes sense). Anyone know how I would be able to achieve my desired RLP?
(id = uid()) OR (company_id = ( SELECT users_1.company_id
FROM users users_1
WHERE (users_1.id = uid())
LIMIT 1)))