Fix the groupsummarie's grouping in case of PostgreSQL

fixes #7859