There's one gotcha with this approach: if there's another DDL operation running simultaneously with REFRESH MATERIALIZED VIEW, you'd get an internal postgres error.
You cannot be sure that refresh won't coincide with a grant on all tables in the schema, for example.
You cannot be sure that refresh won't coincide with a grant on all tables in the schema, for example.