Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uezpB-000kVR-Dc for pgsql-bugs@arkaria.postgresql.org; Thu, 24 Jul 2025 17:33:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uezpA-009R9B-28 for pgsql-bugs@arkaria.postgresql.org; Thu, 24 Jul 2025 17:33:44 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uezp9-009R93-Po for pgsql-bugs@lists.postgresql.org; Thu, 24 Jul 2025 17:33:44 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1uezp8-000aVu-0p for pgsql-bugs@lists.postgresql.org; Thu, 24 Jul 2025 17:33:43 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 56OHXaME1672784; Thu, 24 Jul 2025 13:33:36 -0400 From: Tom Lane To: jinhui-lai@foxmail.com cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #18997: Two equivalent queries return different results In-reply-to: <18997-5da9d229e6f13364@postgresql.org> References: <18997-5da9d229e6f13364@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Thu, 24 Jul 2025 14:45:17 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1672782.1753378416.1@sss.pgh.pa.us> Date: Thu, 24 Jul 2025 13:33:36 -0400 Message-ID: <1672783.1753378416@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk PG Bug reporting form 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