I have a PostgreSQL DB, where I use materialized views. The problem occurs when I try to refresh these materialized views.
REFRESH MATERIALIZED VIEW produc
You will have to create a unique index on the materialized view itself.
This would look like this:
CREATE UNIQUE INDEX ON productsforproject (id);
Replace id with a suitable unique key column or a (comma separated) combination of such columns.
id