*/
if (havingClause != null)
{
ReplaceAggregatesWithCRVisitor visitor =
new ReplaceAggregatesWithCRVisitor(selectList, ResultSetNode.class);
havingClause = (ValueNode)havingClause.accept(visitor);
// fix for HAVING without GROUP BY, makes sure we get one
// aggregate operator by adding a count(*), this fixes beetle 5853, 5890
if (groupByList == null) {
ValueNode vn = (ValueNode) nodeFactory.getNode(