Added check for pg_checkpoint role presence (#807)

* Added check for pg_checkpoint role presence

This commit provides the needed infrastructure in `repmgr` so if the `repmgr` database
user is a member of the `pg_checkpoint` role, and inherits its privileges, there is no 
need for such a user to be a superuser.

Co-authored-by: Martín Marqués <martin.marques@enterprisedb.com>
This commit is contained in:
RealGreenDragon
2024-09-11 20:13:44 +02:00
committed by GitHub
parent b4a0938081
commit f69485c0ba
7 changed files with 82 additions and 9 deletions

View File

@@ -5288,7 +5288,7 @@ do_standby_switchover(void)
checkpoint_conn = superuser_conn;
}
if (is_superuser_connection(checkpoint_conn, NULL) == true)
if (can_execute_checkpoint(checkpoint_conn) == true)
{
log_notice(_("issuing CHECKPOINT on node \"%s\" (ID: %i) "),
config_file_options.node_name,
@@ -5297,7 +5297,16 @@ do_standby_switchover(void)
}
else
{
log_warning(_("no superuser connection available, unable to issue CHECKPOINT"));
log_warning(_("no authorized connection available, unable to issue CHECKPOINT"));
if (PQserverVersion(conn) >= 150000)
{
log_hint(_("provide a superuser with -S/--superuser or grant pg_checkpoint role to repmgr user"));
}
else
{
log_hint(_("provide a superuser with -S/--superuser"));
}
}
}