view schema/updates/1453/01.update_dqr_stats.sql @ 5510:b7792e8d5c62 deactivate-users

Client: Improve users-table layout * Make editing/reactivating of users more recognizable by adding a reactive/edit button to the action column, that behaves according to the user's status(active,inactive). * Disable clicking the other cells for editing user.
author Fadi Abbud <fadi.abbud@intevation.de>
date Wed, 29 Sep 2021 17:10:42 +0200
parents 1dd63a2405bc
children
line wrap: on
line source

-- We need a wrapper procedure with owner rights for
-- the refresh, as (from the PGSQL manual): "REFRESH MATERIALIZED VIEW
-- completely replaces the contents of a materialized view. To execute
-- this command you must be the owner of the materialized view.""

CREATE OR REPLACE PROCEDURE sys_admin.update_dqr_stats()
LANGUAGE plpgsql AS $$
BEGIN
    EXECUTE 'REFRESH MATERIALIZED VIEW waterway.dqr_bottleneck_stats';
    EXECUTE 'REFRESH MATERIALIZED VIEW waterway.dqr_gauge_stats';
END;
$$ SECURITY DEFINER;

GRANT EXECUTE ON PROCEDURE sys_admin.update_dqr_stats() TO sys_admin;

-- Config update statement
INSERT INTO sys_admin.stats_updates
    VALUES ('Data quality report',
            'CALL sys_admin.update_dqr_stats();');