1 /* contrib/pg_walinspect/pg_walinspect--1.0.sql */
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
7 -- pg_get_wal_record_info()
9 CREATE FUNCTION pg_get_wal_record_info(IN in_lsn pg_lsn,
14 OUT resource_manager text,
16 OUT record_length int4,
17 OUT main_data_length int4,
22 AS 'MODULE_PATHNAME', 'pg_get_wal_record_info'
23 LANGUAGE C STRICT PARALLEL SAFE;
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;
29 -- pg_get_wal_records_info()
31 CREATE FUNCTION pg_get_wal_records_info(IN start_lsn pg_lsn,
37 OUT resource_manager text,
39 OUT record_length int4,
40 OUT main_data_length int4,
46 AS 'MODULE_PATHNAME', 'pg_get_wal_records_info'
47 LANGUAGE C STRICT PARALLEL SAFE;
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;
53 -- pg_get_wal_records_info_till_end_of_wal()
55 CREATE FUNCTION pg_get_wal_records_info_till_end_of_wal(IN start_lsn pg_lsn,
60 OUT resource_manager text,
62 OUT record_length int4,
63 OUT main_data_length int4,
69 AS 'MODULE_PATHNAME', 'pg_get_wal_records_info_till_end_of_wal'
70 LANGUAGE C STRICT PARALLEL SAFE;
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;
78 CREATE FUNCTION pg_get_wal_stats(IN start_lsn pg_lsn,
80 IN per_record boolean DEFAULT false,
81 OUT "resource_manager/record_type" text,
83 OUT count_percentage float8,
85 OUT record_size_percentage float8,
87 OUT fpi_size_percentage float8,
88 OUT combined_size int8,
89 OUT combined_size_percentage float8
92 AS 'MODULE_PATHNAME', 'pg_get_wal_stats'
93 LANGUAGE C STRICT PARALLEL SAFE;
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;
99 -- pg_get_wal_stats_till_end_of_wal()
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,
105 OUT count_percentage float8,
106 OUT record_size int8,
107 OUT record_size_percentage float8,
109 OUT fpi_size_percentage float8,
110 OUT combined_size int8,
111 OUT combined_size_percentage float8
114 AS 'MODULE_PATHNAME', 'pg_get_wal_stats_till_end_of_wal'
115 LANGUAGE C STRICT PARALLEL SAFE;
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;