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