Re: Incremental View Maintenance, take 2

From: Yugo NAGATA <nagata(at)sraoss(dot)co(dot)jp>
To: jian he <jian(dot)universality(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Incremental View Maintenance, take 2
Date: 2023-08-27 17:49:08
Message-ID: 20230828024908.2667bcde8d2963256375bd6c@sraoss.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, 2 Jul 2023 10:38:20 +0800
jian he <jian(dot)universality(at)gmail(dot)com> 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 <nagata(at)sraoss(dot)co(dot)jp>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message vignesh C 2023-08-27 18:32:28 Re: persist logical slots to disk during shutdown checkpoint
Previous Message Chapman Flack 2023-08-27 16:56:18 Re: UTF8 national character data type support WIP patch and list of open issues.