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 1pRN8F-0002uV-Or for pgsql-bugs@arkaria.postgresql.org; Mon, 13 Feb 2023 00:55:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pRN8E-0002vm-7I for pgsql-bugs@arkaria.postgresql.org; Mon, 13 Feb 2023 00:55:46 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pRN8D-0002s7-Ug for pgsql-bugs@lists.postgresql.org; Mon, 13 Feb 2023 00:55:45 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pRN8B-0002Wd-A0 for pgsql-bugs@lists.postgresql.org; Mon, 13 Feb 2023 00:55:45 +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 31D0tbIP988100; Sun, 12 Feb 2023 19:55:37 -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> Comments: In-reply-to David Rowley message dated "Mon, 13 Feb 2023 13:31:54 +1300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <988098.1676249737.1@sss.pgh.pa.us> Date: Sun, 12 Feb 2023 19:55:37 -0500 Message-ID: <988099.1676249737@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 05:19, Tom Lane wrote: >> Why is it okay to check only the filter, and not the rest of the >> WindowFunc's subexpressions? The arguments we've just run through >> seem to apply to a subplan in the direct or aggregated arguments >> as well. > Good point. I had just been thinking in terms of the reported bug to > make sure we inverse transition the same rows we transition. We also > need to make sure the transition value matches in both transition > directions. > I've adjusted the patch accordingly. Code looks good now, but the comment still claims this is only important in the FILTER clause. I'd rewrite the whole thing perhaps: * We also don't risk using moving aggregates when there are subplans * in the arguments or FILTER clause. This is partly because * contain_volatile_functions() doesn't look inside subplans; but * there are other reasons why a subplan's output might be volatile. * For example, syncscan mode can render the results nonrepeatable. regards, tom lane