Debian Codegraph @

contrib/pg_walinspect/pg_walinspect--1.0.sql

raw
1 /* contrib/pg_walinspect/pg_walinspect--1.0.sql */
2
3 -- complain if script is sourced in psql, rather than via CREATE EXTENSION
4 \echo Use "CREATE EXTENSION pg_walinspect" to load this file. \quit
5
6 --
7 -- pg_get_wal_record_info()
8 --
9 CREATE FUNCTION pg_get_wal_record_info(IN in_lsn pg_lsn,
10 OUT start_lsn pg_lsn,
11 OUT end_lsn pg_lsn,
12 OUT prev_lsn pg_lsn,
13 OUT xid xid,
14 OUT resource_manager text,
15 OUT record_type text,
16 OUT record_length int4,
17 OUT main_data_length int4,
18 OUT fpi_length int4,
19 OUT description text,
20 OUT block_ref text
21 )
22 AS 'MODULE_PATHNAME', 'pg_get_wal_record_info'
23 LANGUAGE C STRICT PARALLEL SAFE;
24
25 REVOKE EXECUTE ON FUNCTION pg_get_wal_record_info(pg_lsn) FROM PUBLIC;
26 GRANT EXECUTE ON FUNCTION pg_get_wal_record_info(pg_lsn) TO pg_read_server_files;
27
28 --
29 -- pg_get_wal_records_info()
30 --
31 CREATE FUNCTION pg_get_wal_records_info(IN start_lsn pg_lsn,
32 IN end_lsn pg_lsn,
33 OUT start_lsn pg_lsn,
34 OUT end_lsn pg_lsn,
35 OUT prev_lsn pg_lsn,
36 OUT xid xid,
37 OUT resource_manager text,
38 OUT record_type text,
39 OUT record_length int4,
40 OUT main_data_length int4,
41 OUT fpi_length int4,
42 OUT description text,
43 OUT block_ref text
44 )
45 RETURNS SETOF record
46 AS 'MODULE_PATHNAME', 'pg_get_wal_records_info'
47 LANGUAGE C STRICT PARALLEL SAFE;
48
49 REVOKE EXECUTE ON FUNCTION pg_get_wal_records_info(pg_lsn, pg_lsn) FROM PUBLIC;
50 GRANT EXECUTE ON FUNCTION pg_get_wal_records_info(pg_lsn, pg_lsn) TO pg_read_server_files;
51
52 --
53 -- pg_get_wal_records_info_till_end_of_wal()
54 --
55 CREATE FUNCTION pg_get_wal_records_info_till_end_of_wal(IN start_lsn pg_lsn,
56 OUT start_lsn pg_lsn,
57 OUT end_lsn pg_lsn,
58 OUT prev_lsn pg_lsn,
59 OUT xid xid,
60 OUT resource_manager text,
61 OUT record_type text,
62 OUT record_length int4,
63 OUT main_data_length int4,
64 OUT fpi_length int4,
65 OUT description text,
66 OUT block_ref text
67 )
68 RETURNS SETOF record
69 AS 'MODULE_PATHNAME', 'pg_get_wal_records_info_till_end_of_wal'
70 LANGUAGE C STRICT PARALLEL SAFE;
71
72 REVOKE EXECUTE ON FUNCTION pg_get_wal_records_info_till_end_of_wal(pg_lsn) FROM PUBLIC;
73 GRANT EXECUTE ON FUNCTION pg_get_wal_records_info_till_end_of_wal(pg_lsn) TO pg_read_server_files;
74
75 --
76 -- pg_get_wal_stats()
77 --
78 CREATE FUNCTION pg_get_wal_stats(IN start_lsn pg_lsn,
79 IN end_lsn pg_lsn,
80 IN per_record boolean DEFAULT false,
81 OUT "resource_manager/record_type" text,
82 OUT count int8,
83 OUT count_percentage float8,
84 OUT record_size int8,
85 OUT record_size_percentage float8,
86 OUT fpi_size int8,
87 OUT fpi_size_percentage float8,
88 OUT combined_size int8,
89 OUT combined_size_percentage float8
90 )
91 RETURNS SETOF record
92 AS 'MODULE_PATHNAME', 'pg_get_wal_stats'
93 LANGUAGE C STRICT PARALLEL SAFE;
94
95 REVOKE EXECUTE ON FUNCTION pg_get_wal_stats(pg_lsn, pg_lsn, boolean) FROM PUBLIC;
96 GRANT EXECUTE ON FUNCTION pg_get_wal_stats(pg_lsn, pg_lsn, boolean) TO pg_read_server_files;
97
98 --
99 -- pg_get_wal_stats_till_end_of_wal()
100 --
101 CREATE FUNCTION pg_get_wal_stats_till_end_of_wal(IN start_lsn pg_lsn,
102 IN per_record boolean DEFAULT false,
103 OUT "resource_manager/record_type" text,
104 OUT count int8,
105 OUT count_percentage float8,
106 OUT record_size int8,
107 OUT record_size_percentage float8,
108 OUT fpi_size int8,
109 OUT fpi_size_percentage float8,
110 OUT combined_size int8,
111 OUT combined_size_percentage float8
112 )
113 RETURNS SETOF record
114 AS 'MODULE_PATHNAME', 'pg_get_wal_stats_till_end_of_wal'
115 LANGUAGE C STRICT PARALLEL SAFE;
116
117 REVOKE EXECUTE ON FUNCTION pg_get_wal_stats_till_end_of_wal(pg_lsn, boolean) FROM PUBLIC;
118 GRANT EXECUTE ON FUNCTION pg_get_wal_stats_till_end_of_wal(pg_lsn, boolean) TO pg_read_server_files;