MDL-46647 grades: Fix fetch_all_helper() towards cross-db