I am trying to write a simple SQL function that will be used as a computed field in Hasura.io platform.
CREATE OR REPLACE FUNCTION calling_mode(calling_row calling, hasura_session json)
RETURNS text AS $$
SELECT CASE
WHEN calling_row.seekerUserId = hasura_session ->> 'x-hasura-user-id' THEN 'seeker'
WHEN calling_row.partnerUserId = hasura_session ->> 'x-hasura-user-id' THEN 'partner'
ELSE 'none'
END
$$ LANGUAGE sql STABLE;
This gives me an error missing FROM-clause entry for table "calling_row".
I tried looking through several docs, but it doesn't make any sense to me.