Fix random_category query with an outer join.