sql – Supabase function for querying related tables with GraphQL

Pretty bummed to find out Supabase does not allow queries on related tables out of the box with GraphQL. I’m trying to create a function to help accomplish this but I’m stuck. When I run this SQL script it does so successfully but when I try to hit it in the GraphiQL playground I the function doesn’t exist.

create or replace function filter_events_search(gender text)
  returns table (
    event_id uuid
  )
  immutable
  language sql
as $$
  select
    e.id as event_id
  from 
    events e
  join
    teams t on e.team_id = t.id
  where e.status="pending" and t.gender = gender
$$

Any suggestions? I’ve tried stable vs immutable as well.

Read more here: Source link