Ignore order when doing count.

This is necessary because Postgresql doesn't play nice with ORDER BY and
no GROUP BY.

Fixes #14621.
Merge pull request #14631 from laurocaetano/fix_count_with_order

Ignore order when doing count.