https://supabase.com/ logo
hi there, i’m stuck on this for hours.. if any kin...
# off-topic
l
hi there, i’m stuck on this for hours.. if any kind soul can help.. i have 3 tables a_investors (id, name, user_id) a_startup (id, name, user_id) a_investor_startup (id, investor_id, startup_id) an investor can only query in investor_startup when it matches his id. Likewise for a startup. Tried this but getting null on the frontend
Copy code
CREATE OR REPLACE FUNCTION is_member_of_investorstartup(_startup_id int8, _investor_id int8) RETURNS bool AS $$SELECT

EXISTS (  
  SELECT 1  FROM a_investors_startups om  
  WHERE om.investor_id = _investor_id  
  AND om.startup_id = _startup_id)

;$$ LANGUAGE sql SECURITY DEFINER;
Copy code
const { data, error, status } = 
  await supabase.from("a_investors_startups").select(          `id,a_startups( name )`);
Copy code
is_member_of_investorstartup(startup_id, investor_id)
Any idea what RLS can achieve this?