Resource embedding with a one-to-one view #1895
-
|
Hi there! I'm trying to use Supabase (with PostgREST 😃), and I have the following schema:
Extended definition from psqlI'm trying to query with a one-to-one mapping. Calling Looking at the documentation, seems that embedding views should work. Why would that be? Am I doing something wrong? At first I thought that maybe it's related to the join over SELECT profiles.id AS profile_id,
'https://hello/'::text || profiles.id AS url
FROM profiles;Any assistance will be much appreciated! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
|
Hey @Schniz,
Yes, embedding views work as long as there are foreign key relationships on the tables it's based on. The For this case, you could make a VIEW of the |
Beta Was this translation helpful? Give feedback.
Hey @Schniz,
Yes, embedding views work as long as there are foreign key relationships on the tables it's based on.
The
derived_avatarsview is basically theprofilestable underneath, and there's no foreign key relationship betweenprofilesandprofiles- so it's not really a one-to-one relationship.For this case, you could make a VIEW of the
userstable(hiding some columns), saymy_users, and then you should be able to embedprofileswithmy_users(/profiles?select=*,my_users(*)).