© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•4y ago•
10 replies
Max52

RLS policy with join not working

I've structured my insert RLS policy to what I think would work based on the docs and my tables:
(has_course(( SELECT course_id
   FROM thread
  WHERE (thread_id = id)), uid()) AND (user_id = uid()))
(has_course(( SELECT course_id
   FROM thread
  WHERE (thread_id = id)), uid()) AND (user_id = uid()))

However when I save and try it, I get an RLS error. Then when I go into the policy editor, it changes to:
(has_course(( SELECT thread.course_id
   FROM thread
  WHERE (reply.thread_id = thread.id)), uid()) AND (user_id = uid()))
(has_course(( SELECT thread.course_id
   FROM thread
  WHERE (reply.thread_id = thread.id)), uid()) AND (user_id = uid()))

Which might just be a more explicit version that Supabase automatically updates to? Either way, I can't seem to get this policy working right.
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

RLS Policy With Join
SupabaseSSupabase / help-and-questions
4y ago
Simple RLS Policy with Join
SupabaseSSupabase / help-and-questions
4y ago
Writing RLS policy with join
SupabaseSSupabase / help-and-questions
4y ago
RLS policy 'in' not working
SupabaseSSupabase / help-and-questions
4y ago