Materialized views and unique indexes

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Materialized views and unique indexes
Дата
Msg-id CAB7nPqT1GhYNWA1Cbv5LAm+baD9mYi31WzZ_aQ6CXWS+G1v4jA@mail.gmail.com
обсуждение исходный текст
Ответы Re: Materialized views and unique indexes  (Josh Berkus <josh@agliodbs.com>)
Список pgsql-hackers
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 /> 

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: REFRESH MATERIALIZED VIEW locklevel
Следующее
От: Josh Berkus
Дата:
Сообщение: Re: Materialized views and unique indexes