Skip to content

Commit 910c3ec

Browse files
committed
Change scripts
1 parent f943143 commit 910c3ec

File tree

3 files changed

+117
-1
lines changed

3 files changed

+117
-1
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
*.o
33
*.so
44
/results
5-
*.log
5+
*pg_wait_sampling--1.1.sql
6+
.log

pg_wait_sampling--1.0--1.1.sql

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/* contrib/pg_wait_sampling/pg_wait_sampling--1.0--1.1.sql */
2+
3+
DROP FUNCTION pg_wait_sampling_get_current (
4+
pid int4,
5+
OUT pid int4,
6+
OUT event_type text,
7+
OUT event text
8+
);
9+
10+
DROP FUNCTION pg_wait_sampling_get_history (
11+
OUT pid int4,
12+
OUT ts timestamptz,
13+
OUT event_type text,
14+
OUT event text
15+
);
16+
17+
DROP FUNCTION pg_wait_sampling_get_profile (
18+
OUT pid int4,
19+
OUT event_type text,
20+
OUT event text,
21+
OUT count bigint
22+
);
23+
24+
CREATE FUNCTION pg_wait_sampling_get_current (
25+
pid int4,
26+
OUT pid int4,
27+
OUT event_type text,
28+
OUT event text,
29+
OUT queryid int8
30+
)
31+
RETURNS SETOF record
32+
AS 'MODULE_PATHNAME'
33+
LANGUAGE C VOLATILE CALLED ON NULL INPUT;
34+
35+
CREATE FUNCTION pg_wait_sampling_get_history (
36+
OUT pid int4,
37+
OUT ts timestamptz,
38+
OUT event_type text,
39+
OUT event text,
40+
OUT queryid int8
41+
)
42+
RETURNS SETOF record
43+
AS 'MODULE_PATHNAME'
44+
LANGUAGE C VOLATILE STRICT;
45+
46+
CREATE FUNCTION pg_wait_sampling_get_profile (
47+
OUT pid int4,
48+
OUT event_type text,
49+
OUT event text,
50+
OUT queryid int8,
51+
OUT count int8
52+
)
53+
RETURNS SETOF record
54+
AS 'MODULE_PATHNAME'
55+
LANGUAGE C VOLATILE STRICT;

setup.sql

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/* contrib/pg_wait_sampling/setup.sql */
2+
3+
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
4+
\echo Use "CREATE EXTENSION pg_wait_sampling" to load this file. \quit
5+
6+
CREATE FUNCTION pg_wait_sampling_get_current (
7+
pid int4,
8+
OUT pid int4,
9+
OUT event_type text,
10+
OUT event text,
11+
OUT queryid int8
12+
)
13+
RETURNS SETOF record
14+
AS 'MODULE_PATHNAME'
15+
LANGUAGE C VOLATILE CALLED ON NULL INPUT;
16+
17+
CREATE VIEW pg_wait_sampling_current AS
18+
SELECT * FROM pg_wait_sampling_get_current(NULL::integer);
19+
20+
GRANT SELECT ON pg_wait_sampling_current TO PUBLIC;
21+
22+
CREATE FUNCTION pg_wait_sampling_get_history (
23+
OUT pid int4,
24+
OUT ts timestamptz,
25+
OUT event_type text,
26+
OUT event text,
27+
OUT queryid int8
28+
)
29+
RETURNS SETOF record
30+
AS 'MODULE_PATHNAME'
31+
LANGUAGE C VOLATILE STRICT;
32+
33+
CREATE VIEW pg_wait_sampling_history AS
34+
SELECT * FROM pg_wait_sampling_get_history();
35+
36+
GRANT SELECT ON pg_wait_sampling_history TO PUBLIC;
37+
38+
CREATE FUNCTION pg_wait_sampling_get_profile (
39+
OUT pid int4,
40+
OUT event_type text,
41+
OUT event text,
42+
OUT queryid int8,
43+
OUT count int8
44+
)
45+
RETURNS SETOF record
46+
AS 'MODULE_PATHNAME'
47+
LANGUAGE C VOLATILE STRICT;
48+
49+
CREATE VIEW pg_wait_sampling_profile AS
50+
SELECT * FROM pg_wait_sampling_get_profile();
51+
52+
GRANT SELECT ON pg_wait_sampling_profile TO PUBLIC;
53+
54+
CREATE FUNCTION pg_wait_sampling_reset_profile()
55+
RETURNS void
56+
AS 'MODULE_PATHNAME'
57+
LANGUAGE C VOLATILE STRICT;
58+
59+
-- Don't want this to be available to non-superusers.
60+
REVOKE ALL ON FUNCTION pg_wait_sampling_reset_profile() FROM PUBLIC;

0 commit comments

Comments
 (0)