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.96) (envelope-from ) id 1wuwzl-0010If-0m for pgsql-bugs@arkaria.postgresql.org; Fri, 14 Aug 2026 18:51:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wuwzj-0029tW-0J for pgsql-bugs@arkaria.postgresql.org; Fri, 14 Aug 2026 18:51: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.96) (envelope-from ) id 1wuwzi-0029tO-2j for pgsql-bugs@lists.postgresql.org; Fri, 14 Aug 2026 18:51:07 +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 1wuwzh-00000000kmv-0RKh for pgsql-bugs@lists.postgresql.org; Fri, 14 Aug 2026 18:51: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 67EIp3Gm3777655; Fri, 14 Aug 2026 14:51:03 -0400 From: Tom Lane To: Andrey Rachitskiy cc: malis@pgrust.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #19619: WHERE scale(n) = 1 pushed past GROUP BY / window PARTITION BY, wrong COUNT In-reply-to: References: <19619-fc646db1c6b2dc90@postgresql.org> Comments: In-reply-to Andrey Rachitskiy message dated "Fri, 14 Aug 2026 23:30:17 +0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3777653.1786733463.1@sss.pgh.pa.us> Date: Fri, 14 Aug 2026 14:51:03 -0400 Message-ID: <3777654.1786733463@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Andrey Rachitskiy writes: > Tom's view on the HAVING form was that the query is ill-posed. > The group's representative among equal numerics is unspecified, so > HAVING scale(c) = 1 after grouping is not well defined. > https://postgr.es/m/1738062.1784927903@sss.pgh.pa.us Yeah. I'd be more excited about doing something about this if we'd required opclasses to say whether their equality operator is image equality or something weaker. But that was never designed into the system, and retrofitting it now would be a mess. Since the only benefit would be to queries that are arguably wrong anyway, it's difficult to justify the effort. regards, tom lane