title: Postgres trigger refreshing a materialized view not working after some time
body: <p>I have a materialized view created and a trigger to refresh it after any update on the source table.</p>
  <p>Everything seems to work oke, but after a while seems that the trigger stops working since the materialized view remains with stale data.</p>
  <p>At some point after I recreated the trigger the functionality started to work again.</p>
  <p>The postgres version used in 11.</p>
  <pre><code>CREATE OR REPLACE FUNCTION refresh_some_view()
      RETURNS TRIGGER
      LANGUAGE PLPGSQL
  AS
  $$
  BEGIN
      REFRESH MATERIALIZED VIEW some_view;
      RETURN NEW;
  END;
  $$;
  
  
  CREATE TRIGGER on_source_table_update
      AFTER UPDATE OR INSERT OR DELETE
      ON source_table
      FOR EACH ROW
  EXECUTE PROCEDURE refresh_some_view();
  </code></pre>