Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pRRPo-0006KB-Pk for pgsql-bugs@arkaria.postgresql.org; Mon, 13 Feb 2023 05:30:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pRRPn-00041F-JA for pgsql-bugs@arkaria.postgresql.org; Mon, 13 Feb 2023 05:30:11 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pRRPn-0003zm-Ao for pgsql-bugs@lists.postgresql.org; Mon, 13 Feb 2023 05:30:11 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pRRPl-0005wc-0O for pgsql-bugs@lists.postgresql.org; Mon, 13 Feb 2023 05:30:10 +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 31D5U2lu1020529; Mon, 13 Feb 2023 00:30:02 -0500 From: Tom Lane To: David Rowley cc: Andres Freund , xinwen@stu.scu.edu.cn, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #17777: An assert failed in nodeWindowAgg.c In-reply-to: References: <17777-860b739b6efde977@postgresql.org> <20230210230230.scuk6gqrks6c7sc7@awork3.anarazel.de> <439391.1676070752@sss.pgh.pa.us> <20230210232051.efjhtoqo6odk3gke@awork3.anarazel.de> <443909.1676073430@sss.pgh.pa.us> <20230211004940.t5l2dz7rnss76zao@awork3.anarazel.de> <842393.1676218781@sss.pgh.pa.us> <20230213004633.udoooi3gabxvtfbw@awork3.anarazel.de> Comments: In-reply-to David Rowley message dated "Mon, 13 Feb 2023 16:21:11 +1300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1020527.1676266202.1@sss.pgh.pa.us> Date: Mon, 13 Feb 2023 00:30:02 -0500 Message-ID: <1020528.1676266202@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk David Rowley writes: > On Mon, 13 Feb 2023 at 13:46, Andres Freund wrote: >> What about find_compatible_agg()? I don't think there's as severe >> consequences, but it also doesn't seem right as-is. > This does not seem related to the issue being reported here. It seems > to me this would only affect the aggregate deduplication logic and > nothing else. > For the case you're complaining about, I don't think shifting the > goalposts randomly in back-branches is a good idea. For the one you > reported we might upset someone who has come to rely on the aggstate > deduplication either for performance or for the number of volatile > function evaluations. I'm not really on board with changing that > unless someone highlights that it's causing an actual problem. Yeah. This behavior is at least semi-documented, IIRC. We need to fix moving-aggregate mode so it's not used when its assumptions don't hold, because there's no way that that doesn't lead to insane behavior. But redefining the deduplication rules seems way more likely to break existing queries than make anybody happy. regards, tom lane