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.94.2) (envelope-from ) id 1qaJsy-008rNU-Ag for pgsql-hackers@arkaria.postgresql.org; Sun, 27 Aug 2023 17:49:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qaJsx-001UFl-1Q for pgsql-hackers@arkaria.postgresql.org; Sun, 27 Aug 2023 17:49:14 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qaJsw-001UFa-MX for pgsql-hackers@lists.postgresql.org; Sun, 27 Aug 2023 17:49:14 +0000 Received: from ml.sraoss.co.jp ([66.11.59.17]) by makus.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qaJst-001Go5-Fw for pgsql-hackers@postgresql.org; Sun, 27 Aug 2023 17:49:13 +0000 Received: from sranhm.sraoss.co.jp (unknown [192.168.174.164]) by osspc26.sraoss.co.jp (Postfix) with ESMTP id F2D142F00109; Mon, 28 Aug 2023 02:49:08 +0900 (JST) Received: from yugon-CFSV7-1 (unknown [192.168.176.1]) by sranhm.sraoss.co.jp (Postfix) with SMTP id D23F834188A; Mon, 28 Aug 2023 02:49:08 +0900 (JST) Date: Mon, 28 Aug 2023 02:49:08 +0900 From: Yugo NAGATA To: jian he Cc: pgsql-hackers@postgresql.org Subject: Re: Incremental View Maintenance, take 2 Message-Id: <20230828024908.2667bcde8d2963256375bd6c@sraoss.co.jp> In-Reply-To: References: <20230601235909.0e1572c27e59112f9d0cbe86@sraoss.co.jp> <20230601034703.9e4f81f5d92ae6e3949b84d2@sraoss.co.jp> <20230628170604.505955118ac2f91abd554f13@sraoss.co.jp> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sun, 2 Jul 2023 10:38:20 +0800 jian he wrote: > ok. Now I really found a small bug. > > this works as intended: > BEGIN; > CREATE INCREMENTAL MATERIALIZED VIEW test_ivm AS SELECT i, MIN(j) as > min_j FROM mv_base_a group by 1; > INSERT INTO mv_base_a select 1,-2 where false; > rollback; > > however the following one: > BEGIN; > CREATE INCREMENTAL MATERIALIZED VIEW test_ivm1 AS SELECT MIN(j) as > min_j FROM mv_base_a; > INSERT INTO mv_base_a select 1, -2 where false; > rollback; > > will evaluate > tuplestore_tuple_count(new_tuplestores) to 1, it will walk through > IVM_immediate_maintenance function to apply_delta. > but should it be zero? This is not a bug because an aggregate without GROUP BY always results one row whose value is NULL. The contents of test_imv1 would be always same as " SELECT MIN(j) as min_j FROM mv_base_a;", isn't it? Regards, Yugo Nagata -- Yugo NAGATA