Function to refresh all materialized views in a PostgreSQL 9.3 database