Fixed issue #1799: aggregate functions like count() should ignore the query limit