getLabelCounters: add caption to group by to fix query failing on pgsql 8.4 (refs #545)