Thanks for your answer.

On 21/10/2018 16.24, Tom Lane wrote:
> In the meantime, the only answer I can think of offhand is to manually
> do VACUUM FREEZE on each of your MVs, and then refresh anything that
> shows up with an error.

Since I have so many of them, I decided to go for a quick-and-dirty
solution (what about REFRESH ALL MATERIALIZED VIEWS in the future?):

> DO
> $$
> DECLARE command text;
> BEGIN
>         FOR command IN SELECT 'REFRESH MATERIALIZED VIEW '|| 
> nspname||'.'||relname||';'
>                 FROM pg_catalog.pg_class c
>                 LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
>                 WHERE c.relkind = 'm'
>         LOOP
>                 RAISE NOTICE '%', command;
>                 EXECUTE command;
>         END LOOP;
> END
> $$;



Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to