Skip to content

Commit 8192f0e

Browse files
committed
Make pg_probackup works again on PostgreSQL 9.5
Function pg_control_system is added in 9.6, which makes check on 9.5 fails all the time. Added logic to bypass that checking of system identifier between data directory DB connection unless DB version is >= 9.6
1 parent 082612b commit 8192f0e

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

src/backup.c

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -934,22 +934,24 @@ check_system_identifiers(void)
934934

935935
system_id_pgdata = get_system_identifier(pgdata);
936936

937-
res = pgut_execute(backup_conn,
937+
if (server_version < 90600) {
938+
} else {
939+
res = pgut_execute(backup_conn,
938940
"SELECT system_identifier FROM pg_control_system()",
939941
0, NULL);
940-
val = PQgetvalue(res, 0, 0);
942+
val = PQgetvalue(res, 0, 0);
941943

942-
if (!parse_uint64(val, &system_id_conn))
943-
{
944+
if (!parse_uint64(val, &system_id_conn))
945+
{
946+
PQclear(res);
947+
elog(ERROR, "%s is not system_identifier", val);
948+
}
944949
PQclear(res);
945-
elog(ERROR, "%s is not system_identifier", val);
946-
}
947-
PQclear(res);
948-
949-
if (system_id_conn != system_identifier)
950-
elog(ERROR, "Backup data directory was initialized for system id %ld, but connected instance system id is %ld",
951-
system_identifier, system_id_conn);
952950

951+
if (system_id_conn != system_identifier)
952+
elog(ERROR, "Backup data directory was initialized for system id %ld, but connected instance system id is %ld",
953+
system_identifier, system_id_conn);
954+
}
953955
if (system_id_pgdata != system_identifier)
954956
elog(ERROR, "Backup data directory was initialized for system id %ld, but target backup directory system id is %ld",
955957
system_identifier, system_id_pgdata);

0 commit comments

Comments
 (0)