prevent role queries when the ids are empty + change the query to suppor...

...t the query cache