Need help with postgres function - Supabase