From 8f5319ce7510a3e9a83d5c8e5645d15c887a3dfa Mon Sep 17 00:00:00 2001 From: Ian Barwick Date: Wed, 11 May 2022 15:25:38 +0900 Subject: [PATCH] Disable exclusive backup check in PostgreSQL 15 and later Exclusive backup functionality was removed in core commit 39969e2a so we can and must avoid checking for exclusive backups. --- dbutils.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/dbutils.c b/dbutils.c index 0275bbde..d449b748 100644 --- a/dbutils.c +++ b/dbutils.c @@ -2079,7 +2079,13 @@ server_in_exclusive_backup_mode(PGconn *conn) { BackupState backup_state = BACKUP_STATE_UNKNOWN; const char *sqlquery = "SELECT pg_catalog.pg_is_in_backup()"; - PGresult *res = PQexec(conn, sqlquery); + PGresult *res = NULL; + + /* Exclusive backup removed from PostgreSQL 15 */ + if (PQserverVersion(conn) >= 150000) + return BACKUP_STATE_NO_BACKUP; + + res = PQexec(conn, sqlquery); if (PQresultStatus(res) != PGRES_TUPLES_OK) {