© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•4y ago•
3 replies
Connor

Joining auth.user on foreign key id?

Hello,

I think this might be me misunderstanding usage, but just in case.

I have a table
teams
teams
that has a column
user_id
user_id
that is a foreign key to
auth.user.id
auth.user.id
.

I want to select from
teams
teams
and join the
auth.user.email
auth.user.email
where the
user_id
user_id
matches the
auth.user.id
auth.user.id
.

const { error, data } = await supabase.from('teams').select('*, user_id:user(email)'); 
const { error, data } = await supabase.from('teams').select('*, user_id:user(email)'); 


I'm guessing it's a syntax issue, it does run, but it tries to refer to a users table in the public schema whereas it exists in the auth schema?

Thanks for any help.

Connor
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

Supabase Foreign Key to Identity ID instead of Auth User ID
SupabaseSSupabase / help-and-questions
13mo ago
How to allow optional user_id foreign key for data?
SupabaseSSupabase / help-and-questions
4y ago
Foreign Key Fails on Trigger
SupabaseSSupabase / help-and-questions
4y ago
Composite key foreign key issue
SupabaseSSupabase / help-and-questions
6mo ago