PG Bug reporting form <noreply@postgresql.org> writes:
> I think these "SELECT COUNT(c0) FILTER (WHERE c0 IS NOT NULL) FROM t0" and
> "SELECT COUNT(c0) FROM t0 WHERE c0 IS NOT NULL;" are equivalent. However,
> their results are different.
You sure your server is 17.5, and not something a little older?
There was a bug of this sort in earlier 17.x releases, but
we fixed it in 17.5. For me, both queries produce "0" as
expected.
regards, tom lane