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.98.2) (envelope-from ) id 1x93Mj-00000001iS2-01Nr for pgsql-bugs@arkaria.postgresql.org; Tue, 22 Sep 2026 16:29:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1x93Mi-0000000HazQ-1K6x for pgsql-bugs@arkaria.postgresql.org; Tue, 22 Sep 2026 16:29:08 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1x93Mi-0000000HazI-0OVe for pgsql-bugs@lists.postgresql.org; Tue, 22 Sep 2026 16:29:08 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1x93Mb-00000000jKZ-2lFh for pgsql-bugs@lists.postgresql.org; Tue, 22 Sep 2026 16:29:07 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.18.1/8.18.1) with ESMTP id 68MGSiFc1187009; Tue, 22 Sep 2026 12:28:44 -0400 From: Tom Lane To: imchifan@163.com cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #19713: WindowAgg qual pushdown gives wrong partition count when scale(numeric) distinguishes equal values In-reply-to: <19713-635b8656d07464df@postgresql.org> References: <19713-635b8656d07464df@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Tue, 22 Sep 2026 16:01:34 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1187007.1790094524.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Tue, 22 Sep 2026 12:28:44 -0400 Message-ID: <1187008.1790094524@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: > An outer scale(numeric) predicate is pushed below WindowAgg even though > numeric values 1.0 and 1.00 are equal under PARTITION BY semantics while > scale() distinguishes them. Isn't this a duplicate of your own bug #19697, as well as bug #19619? What's missing from all of these reports is a reason why scale() would be sane to apply to an aggregated column. Such a query seems inherently misguided to me, precisely because it is interrogating a value that isn't guaranteed consistent across an aggregation group. Is there a real-world use case here, and if so what is it? regards, tom lane [1] https://www.postgresql.org/message-id/19697-6e7ccba388bbe858@postgresq= l.org [2] https://www.postgresql.org/message-id/19619-fc646db1c6b2dc90@postgresq= l.org