Re: BUG #18997: Two equivalent queries return different results

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: jinhui-lai@foxmail.com
Cc: pgsql-bugs@lists.postgresql.org
Date: 2025-07-24T17:33:36Z
Lists: pgsql-bugs
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