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 1pQcZN-00033v-O7 for pgsql-bugs@arkaria.postgresql.org; Fri, 10 Feb 2023 23:12:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pQcZM-00055u-Al for pgsql-bugs@arkaria.postgresql.org; Fri, 10 Feb 2023 23:12:40 +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 1pQcZL-00054N-SV for pgsql-bugs@lists.postgresql.org; Fri, 10 Feb 2023 23:12:39 +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 1pQcZI-0003cg-AJ for pgsql-bugs@lists.postgresql.org; Fri, 10 Feb 2023 23:12:38 +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 31ANCWAG439392; Fri, 10 Feb 2023 18:12:32 -0500 From: Tom Lane To: Andres Freund cc: xinwen@stu.scu.edu.cn, pgsql-bugs@lists.postgresql.org, David Rowley Subject: Re: BUG #17777: An assert failed in nodeWindowAgg.c In-reply-to: <20230210230230.scuk6gqrks6c7sc7@awork3.anarazel.de> References: <17777-860b739b6efde977@postgresql.org> <20230210230230.scuk6gqrks6c7sc7@awork3.anarazel.de> Comments: In-reply-to Andres Freund message dated "Fri, 10 Feb 2023 15:02:30 -0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <439390.1676070752.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Fri, 10 Feb 2023 18:12:32 -0500 Message-ID: <439391.1676070752@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Andres Freund writes: > The problem is that normally we supress the moving aggregate optimizatio= n if a > volatile function is contained in the filter. But unfortunately, > contain_volatile_functions() doesn't descend into subplans. So we don't = see > the volatile expression. I would say that if a volatile function in the argument crashes things, that's an executor bug. You won't get any sympathy from me for complaints about whether contain_volatile_functions noticed that, because *immutability markings can be lies*. It is not acceptable to crash if they're wrong. It looks to me like maybe we could just remove the Assert and do - if (peraggstate->transValueCount =3D=3D 1) + if (peraggstate->transValueCount < 2) a few lines further down? I've not dug into the details though. regards, tom lane