diff --git a/HISTORY b/HISTORY
index a5de2e82..3fcbb2a7 100644
--- a/HISTORY
+++ b/HISTORY
@@ -15,6 +15,7 @@
repmgr: improve output formatting for cluster matrix/crosscheck (Ian)
repmgr: improve database connection failure error checking on the
demotion candidate during "standby switchover" (Ian)
+ repmgr: make repmgr metadata tables dumpable (Ian)
repmgr: fix issue with tablespace mapping when cloning from Barman;
GitHub #650 (Ian)
repmgr: improve handling of pg_control read errors (Ian)
diff --git a/doc/appendix-faq.xml b/doc/appendix-faq.xml
index 4dc2a502..49b96127 100644
--- a/doc/appendix-faq.xml
+++ b/doc/appendix-faq.xml
@@ -379,6 +379,22 @@
+
+ How can I exclude &repmgr; metadata from pg_dump output?
+
+ Beginning with &repmgr; 5.2, the metadata tables associated with the &repmgr; extension
+ (repmgr.nodes, repmgr.events and repmgr.monitoring_history)
+ have been marked as dumpable as they contain configuration and user-generated data.
+
+
+ To exclude these from pg_dump output, add the flag .
+
+
+ To exclude individual &repmgr; metadata tables from pg_dump output, add the flag
+ e.g. . This flag can be provided multiple times
+ to exclude individual tables,
+
+
diff --git a/doc/appendix-release-notes.xml b/doc/appendix-release-notes.xml
index 00589481..aec0aab3 100644
--- a/doc/appendix-release-notes.xml
+++ b/doc/appendix-release-notes.xml
@@ -133,6 +133,12 @@
Improve handling of pg_control read errors.
+
+
+ It is now possible to dump the contents of &repmgr; metadata tables with
+ pg_dump.
+
+
diff --git a/repmgr--5.1--5.2.sql b/repmgr--5.1--5.2.sql
index efddf870..d6556d30 100644
--- a/repmgr--5.1--5.2.sql
+++ b/repmgr--5.1--5.2.sql
@@ -1,2 +1,7 @@
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
\echo Use "CREATE EXTENSION repmgr" to load this file. \quit
+
+SELECT pg_catalog.pg_extension_config_dump('repmgr.nodes', '');
+SELECT pg_catalog.pg_extension_config_dump('repmgr.events', '');
+SELECT pg_catalog.pg_extension_config_dump('repmgr.monitoring_history', '');
+
diff --git a/repmgr--5.2.sql b/repmgr--5.2.sql
index 98cd87c0..e8adbaa7 100644
--- a/repmgr--5.2.sql
+++ b/repmgr--5.2.sql
@@ -15,6 +15,8 @@ CREATE TABLE repmgr.nodes (
config_file TEXT NOT NULL
);
+SELECT pg_catalog.pg_extension_config_dump('repmgr.nodes', '');
+
CREATE TABLE repmgr.events (
node_id INTEGER NOT NULL,
event TEXT NOT NULL,
@@ -23,6 +25,7 @@ CREATE TABLE repmgr.events (
details TEXT NULL
);
+SELECT pg_catalog.pg_extension_config_dump('repmgr.events', '');
CREATE TABLE repmgr.monitoring_history (
primary_node_id INTEGER NOT NULL,
@@ -35,10 +38,11 @@ CREATE TABLE repmgr.monitoring_history (
apply_lag BIGINT NOT NULL
);
-
CREATE INDEX idx_monitoring_history_time
ON repmgr.monitoring_history (last_monitor_time, standby_node_id);
+SELECT pg_catalog.pg_extension_config_dump('repmgr.monitoring_history', '');
+
CREATE VIEW repmgr.show_nodes AS
SELECT n.node_id,
n.node_name,