© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•4y ago•
2 replies
Sarcodo

RLS Policy on a link table

Hey guys, I'm trying to create a SELECT policy on a link table which links to one of the tables which has a user_id field on it. My structure looks something like this:
Link Table:
routine_id, exercise_id

Routine Table:
routine_id, ...otherColumns, user_id (FK to the auth.users table)

How can I setup a policy on the link table, something along the lines of "Show me rows in the link table where the link.routine_id joins to routine.routine_id which has a user_id of uid()"
Sorry if that's not clear, unsure how to word this 😰

Basically, I want to do the standard policy of
auth.uid() = user_id
auth.uid() = user_id
but with a link to another table which contains the user_id column
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

Security RLS policy on users table
SupabaseSSupabase / help-and-questions
7mo ago
RLS Policy
SupabaseSSupabase / help-and-questions
4mo ago
Restrictive RLS policy
SupabaseSSupabase / help-and-questions
2mo ago
RLS policy help
SupabaseSSupabase / help-and-questions
3y ago