Hi all, While testing materialized views, I found the following behavior with unique indexes: postgres=# create table aa as select generate_series(1,3) as a; SELECT 3 postgres=# create materialized view aam as select * from aa; SELECT 3 postgres=# create unique index aam_ind on aam(a); CREATE INDEX postgres=# insert into aa values (4); INSERT 0 1 postgres=# insert into aa values (1); INSERT 0 1 postgres=# refresh materialized view aam; ERROR: could not create unique index "aam_ind" DETAIL: Key (a)=(1) is duplicated. postgres=# select * from aam; a --- 1 2 3 (3 rows)
As expected, the refresh failed, but the error message is not really user-friendly. Shouldn't we output instead something like that? ERROR: could not refresh materialized view because of failure when rebuilding index" DETAIL: key is duplicated. Thanks, -- Michael