Fix small subtle bug in GROUP_BY constraint.

@guenter @krishnap

Commit message should be sufficiently descriptive.