sraoss / pgsql-ivm

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

Unique index on __ivm_* column #55

Closed yugo-n closed 4 years ago

yugo-n commented 4 years ago

When a user make a unique index on __ivmcount, this causes violation on unique constraint and IVM fails, so such constrains on ivm* columns must be forbidden. Rename of these columns also must be avoided.

test5=# create table t (i int);
CREATE TABLE
test5=# create incremental materialized view mv as select * from t;
SELECT 0
test5=# create unique index on mv (__ivm_count__);
CREATE INDEX
test5=# insert into t values (1);
INSERT 0 1
test5=# insert into t values (2);
ERROR:  duplicate key value violates unique constraint "mv___ivm_count___idx"
DETAIL:  Key (__ivm_count__)=(1) already exists.
yugo-n commented 4 years ago

Fixed.