Β© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabaseβ€’4y agoβ€’
5 replies
kalk8279

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"
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

I want to restrict the person who is logged in to only edit their own data - Is RLS the answer?
SupabaseSSupabase / help-and-questions
4y ago
In the realtime feature, can an individual user subscribe to only their own events?
SupabaseSSupabase / help-and-questions
3y ago
RLS Update Own Profile - Denied
SupabaseSSupabase / help-and-questions
4y ago
Can I only allow viewing some columns in RLS?
SupabaseSSupabase / help-and-questions
4y ago