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 1pRF53-0003pl-3t for pgsql-bugs@arkaria.postgresql.org; Sun, 12 Feb 2023 16:19:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pRF51-0008RA-Kp for pgsql-bugs@arkaria.postgresql.org; Sun, 12 Feb 2023 16:19:55 +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 1pRF51-0008Oe-CX for pgsql-bugs@lists.postgresql.org; Sun, 12 Feb 2023 16:19:55 +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 1pRF4w-0006Ks-Qc for pgsql-bugs@lists.postgresql.org; Sun, 12 Feb 2023 16:19:54 +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 31CGJfwV842394; Sun, 12 Feb 2023 11:19:42 -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> Comments: In-reply-to David Rowley message dated "Sun, 12 Feb 2023 23:30:25 +1300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <842392.1676218781.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Sun, 12 Feb 2023 11:19:41 -0500 Message-ID: <842393.1676218781@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk David Rowley writes: > On Sat, 11 Feb 2023 at 13:49, Andres Freund wrote: >> I think we could just add a !contain_subplans() to the code deciding wh= ether >> it's safe to use the movable window optimization? > I think this is a fair way to fix the bug. Agreed. > Here's a patch for that. 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. regards, tom lane