I want to create RLS were gyms can only see their own members

This is the Policy I wrote

-- create the policy
CREATE POLICY gym_members_policy ON members
FOR SELECT
USING (gym_id = current_setting('jwt.claims.gym_id')::integer)
WITH CHECK (gym_id = current_setting('jwt.claims.gym_id')::integer);

-- grant the gym_managers role permission to use the policy
GRANT USAGE ON POLICY gym_members_policy TO gym_managers;

I keep getting this error
Error adding policy: failed to create pg.policies: syntax error at or near "CREATE"
Was this page helpful?