© 2026 Hedgehog Software, LLC

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

Writing RLS policy with join

I'm trying to put together a RLS policy to only allow users enrolled in a course to view the discussions. There are two tables for the discussions, one with top-level threads and one with the replies.

Writing a policy for the reply table, I want to make sure only users who are enrolled in the course can select the replies, however there is no
course_id
course_id
column in this table. There is however a
thread_id
thread_id
which further references
course_id
course_id
. How can I make something like the following policy work?
(is_admin(uid()) OR has_course(thread_id.course_id, uid()))
(is_admin(uid()) OR has_course(thread_id.course_id, uid()))
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
RLS policy with join not working
SupabaseSSupabase / help-and-questions
4y ago
RLS Policy
SupabaseSSupabase / help-and-questions
4mo ago