Listing users by group - ERROR: missing FROM-clause entry for table "groups"

I’ve narrowed it down:

When I reset Edit Directory Columns to default, it works as expected, but when I reorder the columns and include my custom user fields, the issue is reproduced.