From 920d6d1b39749cee31d49e3ddac3c5564861bdac Mon Sep 17 00:00:00 2001 From: Olivier Maury <Olivier.Maury@inrae.fr> Date: Tue, 4 Jun 2024 10:52:24 +0200 Subject: [PATCH] =?UTF-8?q?Utilisation=20d'une=20fonction=20pour=20rafra?= =?UTF-8?q?=C3=AEchir=20la=20vue=20mat=C3=A9rialis=C3=A9e.=20refs=20#10?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sql/schema.functions.postgresql.sql | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 sql/schema.functions.postgresql.sql diff --git a/sql/schema.functions.postgresql.sql b/sql/schema.functions.postgresql.sql new file mode 100644 index 0000000..5884c89 --- /dev/null +++ b/sql/schema.functions.postgresql.sql @@ -0,0 +1,11 @@ +CREATE OR REPLACE FUNCTION refresh_materialized_view() +RETURNS VOID AS $$ +BEGIN + REFRESH MATERIALIZED VIEW agrometinfo.v_pra_dailyvalue; +END; +$$ LANGUAGE plpgsql + SECURITY DEFINER + -- Set a secure search_path: trusted schema(s), then 'pg_temp'. + SET search_path = agrometinfo, pg_temp; +GRANT EXECUTE ON FUNCTION agrometinfo.refresh_materialized_view() TO season; + -- GitLab