File tree Expand file tree Collapse file tree 5 files changed +83
-22
lines changed Expand file tree Collapse file tree 5 files changed +83
-22
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,8 @@ MODULE_big = pg_show_plans
44OBJS = pg_show_plans.o
55
66EXTENSION = pg_show_plans
7- DATA = pg_show_plans--1.0.sql
7+ DATA = pg_show_plans--1.0--1.1.sql \
8+ pg_show_plans--1.1.sql
89REGRESS = pg_show_plans formats
910
1011USE_PGXS = 1
Original file line number Diff line number Diff line change 1+ CREATE FUNCTION pgsp_format_yaml ()
2+ RETURNS void
3+ AS ' MODULE_PATHNAME'
4+ LANGUAGE C;
5+
6+ CREATE FUNCTION pgsp_format_xml ()
7+ RETURNS void
8+ AS ' MODULE_PATHNAME'
9+ LANGUAGE C;
10+
11+ REVOKE ALL ON FUNCTION pgsp_format_yaml() FROM PUBLIC;
12+ REVOKE ALL ON FUNCTION pgsp_format_xml() FROM PUBLIC;
Original file line number Diff line number Diff line change @@ -14,47 +14,35 @@ RETURNS void
1414AS ' MODULE_PATHNAME'
1515LANGUAGE C;
1616
17- CREATE FUNCTION pgsp_format_text ()
18- RETURNS void
19- AS ' MODULE_PATHNAME'
20- LANGUAGE C;
21-
2217CREATE FUNCTION pgsp_format_json ()
2318RETURNS void
2419AS ' MODULE_PATHNAME'
2520LANGUAGE C;
2621
27- CREATE FUNCTION pgsp_format_yaml ()
28- RETURNS void
29- AS ' MODULE_PATHNAME'
30- LANGUAGE C;
31-
32- CREATE FUNCTION pgsp_format_xml ()
22+ CREATE FUNCTION pgsp_format_text ()
3323RETURNS void
3424AS ' MODULE_PATHNAME'
3525LANGUAGE C;
3626
3727CREATE FUNCTION pg_show_plans (
38- OUT pid int8,
39- OUT level int8,
40- OUT userid oid ,
41- OUT dbid oid ,
42- OUT plan text
28+ OUT pid int8,
29+ OUT level int8,
30+ OUT userid oid ,
31+ OUT dbid oid ,
32+ OUT plan text
4333)
4434RETURNS SETOF record
4535AS ' MODULE_PATHNAME'
4636LANGUAGE C;
4737
4838-- Register a view on the function for ease of use.
4939CREATE VIEW pg_show_plans AS
50- SELECT * FROM pg_show_plans();
40+ SELECT * FROM pg_show_plans();
5141
5242GRANT SELECT ON pg_show_plans TO PUBLIC;
5343
5444-- Don't want this to be available to non-superusers.
5545REVOKE ALL ON FUNCTION pg_show_plans_enable() FROM PUBLIC;
5646REVOKE ALL ON FUNCTION pg_show_plans_disable() FROM PUBLIC;
57- REVOKE ALL ON FUNCTION pgsp_format_text() FROM PUBLIC;
5847REVOKE ALL ON FUNCTION pgsp_format_json() FROM PUBLIC;
59- REVOKE ALL ON FUNCTION pgsp_format_yaml() FROM PUBLIC;
60- REVOKE ALL ON FUNCTION pgsp_format_xml() FROM PUBLIC;
48+ REVOKE ALL ON FUNCTION pgsp_format_text() FROM PUBLIC;
Original file line number Diff line number Diff line change 1+ /* pg_show_plans/pg_show_plans--1.0.sql */
2+
3+ -- complain if script is sourced in psql, rather than via CREATE EXTENSION
4+ \echo Use " CREATE EXTENSION pg_show_plans" to load this file. \quit
5+
6+ -- Register functions.
7+ CREATE FUNCTION pg_show_plans_enable ()
8+ RETURNS void
9+ AS ' MODULE_PATHNAME'
10+ LANGUAGE C;
11+
12+ CREATE FUNCTION pg_show_plans_disable ()
13+ RETURNS void
14+ AS ' MODULE_PATHNAME'
15+ LANGUAGE C;
16+
17+ CREATE FUNCTION pgsp_format_text ()
18+ RETURNS void
19+ AS ' MODULE_PATHNAME'
20+ LANGUAGE C;
21+
22+ CREATE FUNCTION pgsp_format_json ()
23+ RETURNS void
24+ AS ' MODULE_PATHNAME'
25+ LANGUAGE C;
26+
27+ CREATE FUNCTION pgsp_format_yaml ()
28+ RETURNS void
29+ AS ' MODULE_PATHNAME'
30+ LANGUAGE C;
31+
32+ CREATE FUNCTION pgsp_format_xml ()
33+ RETURNS void
34+ AS ' MODULE_PATHNAME'
35+ LANGUAGE C;
36+
37+ CREATE FUNCTION pg_show_plans (
38+ OUT pid int8,
39+ OUT level int8,
40+ OUT userid oid ,
41+ OUT dbid oid ,
42+ OUT plan text
43+ )
44+ RETURNS SETOF record
45+ AS ' MODULE_PATHNAME'
46+ LANGUAGE C;
47+
48+ -- Register a view on the function for ease of use.
49+ CREATE VIEW pg_show_plans AS
50+ SELECT * FROM pg_show_plans();
51+
52+ GRANT SELECT ON pg_show_plans TO PUBLIC;
53+
54+ -- Don't want this to be available to non-superusers.
55+ REVOKE ALL ON FUNCTION pg_show_plans_enable() FROM PUBLIC;
56+ REVOKE ALL ON FUNCTION pg_show_plans_disable() FROM PUBLIC;
57+ REVOKE ALL ON FUNCTION pgsp_format_text() FROM PUBLIC;
58+ REVOKE ALL ON FUNCTION pgsp_format_json() FROM PUBLIC;
59+ REVOKE ALL ON FUNCTION pgsp_format_yaml() FROM PUBLIC;
60+ REVOKE ALL ON FUNCTION pgsp_format_xml() FROM PUBLIC;
Original file line number Diff line number Diff line change 11# pg_show_plans extension
22comment = 'show query plans of all currently running SQL statements'
3- default_version = '1.0 '
3+ default_version = '1.1 '
44module_pathname = '$libdir/pg_show_plans'
55relocatable = true
You can’t perform that action at this time.
0 commit comments