Fix for error when aggregate used in having predicate

Would `functionsStack.peek().getSQLsource()` give a nicer error message?