Issue #12457 done. queries_by_roles remake