remove sorting in sql because of postgresql error