sraoss / pgsql-ivm

IVM (Incremental View Maintenance) development for PostgreSQL
Other
129 stars 12 forks source link

The result containing aggregate func is 0 rows #88

Closed thoshiai closed 3 years ago

thoshiai commented 4 years ago

If target rows of aggregate function is 0 rows, MV result is 0 rows. The correct result is 1 rows, this value is 0.

Steps To Reproduce:

$ create table t1(i int primary key, j int);
CREATE TABLE
$ create incremental materialized view mv1 as select count(*) from t1;
SELECT 1
$ insert into t1 select generate_series(1,10000),generate_series(1,10000);
INSERT 0 10000
$ select * from t1 limit 10;
 i  | j  
----+----
  1 |  1
  2 |  2
  3 |  3
  4 |  4
  5 |  5
  6 |  6
  7 |  7
  8 |  8
  9 |  9
 10 | 10
(10 rows)
$ select * from mv1;
 count 
-------
 10000
(1 row)
$ delete from t1;
DELETE 10000
$ select * from mv1;
 count 
-------
(0 rows)
yugo-n commented 4 years ago

@thoshiai Could you please close this issue?