Don't add primary key for aggregate queries
Merge branch '4.1'