Created
December 7, 2015 15:55
-
-
Save jmealo/079ab8dc8b5e9505a128 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE FUNCTION refresh_materialized_views() RETURNS VOID | |
AS | |
$body$ | |
DECLARE | |
result integer; | |
BEGIN | |
EXECUTE (SELECT string_agg('REFRESH MATERIALIZED VIEW ' || oid::regclass::text, ';') | |
FROM pg_class | |
WHERE relkind = 'm'); | |
RETURN; | |
END; | |
$body$ | |
LANGUAGE plpgsql; | |
SELECT refresh_materialized_views(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment