reaches postgresql compatibility for member selection

Postgresql enforces selected columns to be in the group by clause or in
an aggregate function. In addition postgresql and mysql have different
format for returning results for raw sql statements.