Β© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabaseβ€’3y agoβ€’
4 replies
Strange

Querying through references

I think I'm in over my head.

I have a couple of different tables. The first is
profiles
profiles
, which has a fkey
user_id
user_id
referencing
auth.users.id
auth.users.id
. The second is
friends_table
friends_table
, which has two fkeys
user_id
user_id
and
friend_id
friend_id
, both referencing column
user_id
user_id
in the
profiles
profiles
table, not
auth.users
auth.users
. I've set up the RLS such that users can only see rows in which they are the
user_id
user_id
OR the
friend_id
friend_id
, that way I'm not having to duplicate db entries for the sake of ease, however I'm having difficulty querying using the reference. Basically, if a user has a friend, or the friend is the user, I want to use the supabase js library to return the information for the corresponding entries in the
profiles
profiles
table.
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

Querying data through supabase-js is very slow
SupabaseSSupabase / help-and-questions
4mo ago
DATABASE ERROR QUERYING SCHEMA
SupabaseSSupabase / help-and-questions
6mo ago
Issue with Querying IDs
SupabaseSSupabase / help-and-questions
7mo ago
querying vector in swift
SupabaseSSupabase / help-and-questions
13mo ago