File tree Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Expand file tree Collapse file tree 1 file changed +48
-0
lines changed 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_json ()
18+ RETURNS void
19+ AS ' MODULE_PATHNAME'
20+ LANGUAGE C;
21+
22+ CREATE FUNCTION pgsp_format_text ()
23+ RETURNS void
24+ AS ' MODULE_PATHNAME'
25+ LANGUAGE C;
26+
27+ CREATE FUNCTION pg_show_plans (
28+ OUT pid int8,
29+ OUT level int8,
30+ OUT userid oid ,
31+ OUT dbid oid ,
32+ OUT plan text
33+ )
34+ RETURNS SETOF record
35+ AS ' MODULE_PATHNAME'
36+ LANGUAGE C;
37+
38+ -- Register a view on the function for ease of use.
39+ CREATE VIEW pg_show_plans AS
40+ SELECT * FROM pg_show_plans();
41+
42+ GRANT SELECT ON pg_show_plans TO PUBLIC;
43+
44+ -- Don't want this to be available to non-superusers.
45+ REVOKE ALL ON FUNCTION pg_show_plans_enable() FROM PUBLIC;
46+ REVOKE ALL ON FUNCTION pg_show_plans_disable() FROM PUBLIC;
47+ REVOKE ALL ON FUNCTION pgsp_format_json() FROM PUBLIC;
48+ REVOKE ALL ON FUNCTION pgsp_format_text() FROM PUBLIC;
You can’t perform that action at this time.
0 commit comments