Having trouble getting a "WITH" query to run as a function - Supabase