From 16073698aa11a45ff39510724b864e519c603657 Mon Sep 17 00:00:00 2001 From: Artur Zakirov Date: Fri, 7 Apr 2017 15:11:54 +0300 Subject: [PATCH] Use recovery_target_timeline in recovery.conf only with --timeline option --- restore.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/restore.c b/restore.c index 9afa64f7..208d4e22 100644 --- a/restore.c +++ b/restore.c @@ -215,7 +215,7 @@ base_backup_found: dest_backup = (pgBackup *) parray_get(backups, last_diff_index); if (!dest_backup->stream || (target_time != NULL || target_xid != NULL)) create_recovery_conf(backup_id, target_time, target_xid, - target_inclusive, base_backup->tli); + target_inclusive, target_tli); /* cleanup */ parray_walk(backups, pgBackupFree); @@ -676,7 +676,8 @@ create_recovery_conf(time_t backup_id, if (target_inclusive) fprintf(fp, "recovery_target_inclusive = '%s'\n", target_inclusive); - fprintf(fp, "recovery_target_timeline = '%u'\n", target_tli); + if (target_tli) + fprintf(fp, "recovery_target_timeline = '%u'\n", target_tli); fclose(fp); }