Reset select columns after aggregate query. Fixes #1516.
Merge branch '4.0'