Fix roles query

This fixes #10437.
Merge branch 'pgsql' into develop