diff --git a/HISTORY b/HISTORY
index 71cb4e71..36f9a4ac 100644
--- a/HISTORY
+++ b/HISTORY
@@ -2,6 +2,8 @@
general: add support for PostgreSQL 13 (Ian)
general: remove support for PostgreSQL 9.3 (Ian)
config: add support for file inclusion directives (Ian)
+ repmgr: "primary unregister --force" will unregister an active primary
+ with no registered standby nodes (Ian)
repmgr: add option --verify-backup to "standby clone" (Ian)
repmgr: add option --db-connection to "node check" (Ian)
repmgr: report database connection error if the --optformat option was
diff --git a/doc/appendix-release-notes.xml b/doc/appendix-release-notes.xml
index cda1a9d3..b108e1be 100644
--- a/doc/appendix-release-notes.xml
+++ b/doc/appendix-release-notes.xml
@@ -60,6 +60,15 @@
displayed correctly.
+
+
+
+ repmgr primary unregister:
+ the can be provided to unregister an active primary node, provided
+ it has no registered standby nodes.
+
+
+
repmgr standby clone: new option
diff --git a/doc/repmgr-primary-unregister.xml b/doc/repmgr-primary-unregister.xml
index 89f3f60b..8ac0c40d 100644
--- a/doc/repmgr-primary-unregister.xml
+++ b/doc/repmgr-primary-unregister.xml
@@ -60,6 +60,17 @@
+
+
+
+
+ Forcibly unregister the node if it is registered as an active primary,
+ as long as it has no registered standbys; or if it is registered as
+ a primary but running as a standby.
+
+
+
+
diff --git a/repmgr-action-primary.c b/repmgr-action-primary.c
index 331bb766..99bad0ca 100644
--- a/repmgr-action-primary.c
+++ b/repmgr-action-primary.c
@@ -454,9 +454,9 @@ do_primary_unregister(void)
/*
* This appears to be the cluster primary - cowardly refuse to
- * delete the record
+ * delete the record, unless --force is supplied.
*/
- if (primary_node_info.node_id == target_node_info_ptr->node_id)
+ if (primary_node_info.node_id == target_node_info_ptr->node_id && !runtime_options.force)
{
log_error(_("node \"%s\" (ID: %i) is the current primary node, unable to unregister"),
target_node_info_ptr->node_name,