mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-10-02 19:16:54 +02:00
5c1b662807
This commit reworks a bit the set-returning functions of pg_walinspect, making them more flexible regarding their end LSN: - pg_get_wal_records_info() - pg_get_wal_stats() - pg_get_wal_block_info() The end LSNs given to these functions is now handled so as a value higher than the current LSN of the cluster (insert LSN for a primary, or replay LSN for a standby) does not raise an error, giving more flexibility to monitoring queries. Instead, the functions return results up to the current LSN, as found at the beginning of each function call. As an effect of that, pg_get_wal_records_info_till_end_of_wal() and pg_get_wal_stats_till_end_of_wal() are now removed from 1.1, as the existing, equivalent functions are able to offer the same possibilities. Author: Bharath Rupireddy Discussion: https://postgr.es/m/CALj2ACU0_q-o4DSweyaW9NO1KBx-QkN6G_OzYQvpjf3CZVASkg@mail.gmail.com
33 lines
988 B
SQL
33 lines
988 B
SQL
/* contrib/pg_walinspect/pg_walinspect--1.0--1.1.sql */
|
|
|
|
-- complain if script is sourced in psql, rather than via ALTER EXTENSION
|
|
\echo Use "ALTER EXTENSION pg_walinspect UPDATE TO '1.1'" to load this file. \quit
|
|
|
|
-- Unsupported functions after 1.1.
|
|
DROP FUNCTION pg_get_wal_records_info_till_end_of_wal(pg_lsn);
|
|
DROP FUNCTION pg_get_wal_stats_till_end_of_wal(pg_lsn, boolean);
|
|
|
|
--
|
|
-- pg_get_wal_block_info()
|
|
--
|
|
CREATE FUNCTION pg_get_wal_block_info(IN start_lsn pg_lsn,
|
|
IN end_lsn pg_lsn,
|
|
OUT lsn pg_lsn,
|
|
OUT blockid int2,
|
|
OUT reltablespace oid,
|
|
OUT reldatabase oid,
|
|
OUT relfilenode oid,
|
|
OUT relblocknumber int8,
|
|
OUT forkname text,
|
|
OUT blockdata bytea,
|
|
OUT fpi bytea,
|
|
OUT fpilen int4,
|
|
OUT fpiinfo text[]
|
|
)
|
|
RETURNS SETOF record
|
|
AS 'MODULE_PATHNAME', 'pg_get_wal_block_info'
|
|
LANGUAGE C STRICT PARALLEL SAFE;
|
|
|
|
REVOKE EXECUTE ON FUNCTION pg_get_wal_block_info(pg_lsn, pg_lsn) FROM PUBLIC;
|
|
GRANT EXECUTE ON FUNCTION pg_get_wal_block_info(pg_lsn, pg_lsn) TO pg_read_server_files;
|