CREATE OR REPLACE FUNCTION acc_has_expert_rating(ratings acc_rating[])
RETURNS bool AS
$$
DECLARE
rating acc_rating;
BEGIN
FOREACH rating IN ARRAY ratings
LOOP
IF rating."isExpert" THEN
RETURN TRUE;
END IF;
END LOOP;
RETURN false;
END;
$$
LANGUAGE 'plpgsql';