© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•4y ago
FunHellion

RLS on INSERT with linking table

Hi there,

Everyone should be able to insert into a table but only select if they have an entry in the linking table.

The issue here is that I need the team_id for the insert in the linking table (team_members).
I've been searching the internet for the answer but I can't seem to find it.

My table structure is as follows:
teams <-- team_members --> members

RLS statements on teams:
INSERT
true
true


SELECT
(uid() IN ( SELECT team_members.user_id
   FROM team_members
  WHERE (team_members.team_id = teams.id)))
(uid() IN ( SELECT team_members.user_id
   FROM team_members
  WHERE (team_members.team_id = teams.id)))


Hopefully someone can help me with this, thanks in advance!
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 - Help with Insert Policy
SupabaseSSupabase / help-and-questions
4y ago
RLS on related table
SupabaseSSupabase / help-and-questions
8mo ago
RLS on Likes Table
SupabaseSSupabase / help-and-questions
4y ago
RLS With Join Table
SupabaseSSupabase / help-and-questions
4y ago