forked from percona/pg_stat_monitor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpg_stat_monitor--2.3--2.4.sql
More file actions
33 lines (28 loc) · 913 Bytes
/
pg_stat_monitor--2.3--2.4.sql
File metadata and controls
33 lines (28 loc) · 913 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/* contrib/pg_stat_monitor/pg_stat_monitor--2.2--2.3.sql */
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
\echo Use "ALTER EXTENSION pg_stat_monitor" to load this file. \quit
DROP FUNCTION pgsm_create_13_view();
DROP VIEW pg_stat_monitor;
CREATE OR REPLACE FUNCTION pgsm_create_view() RETURNS INT AS
$$
DECLARE ver integer;
BEGIN
SELECT current_setting('server_version_num') INTO ver;
IF (ver >= 180000) THEN
return pgsm_create_18_view();
END IF;
IF (ver >= 170000) THEN
return pgsm_create_17_view();
END IF;
IF (ver >= 150000) THEN
return pgsm_create_15_view();
END IF;
IF (ver >= 140000) THEN
return pgsm_create_14_view();
END IF;
RETURN 0;
END;
$$ LANGUAGE plpgsql;
SELECT pgsm_create_view();
REVOKE ALL ON FUNCTION pgsm_create_view FROM PUBLIC;
GRANT SELECT ON pg_stat_monitor TO PUBLIC;