Skip to content

Commit 1607369

Browse files
author
Artur Zakirov
committed
Use recovery_target_timeline in recovery.conf only with --timeline option
1 parent a40f1f5 commit 1607369

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

restore.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ do_restore(time_t backup_id,
215215
dest_backup = (pgBackup *) parray_get(backups, last_diff_index);
216216
if (!dest_backup->stream || (target_time != NULL || target_xid != NULL))
217217
create_recovery_conf(backup_id, target_time, target_xid,
218-
target_inclusive, base_backup->tli);
218+
target_inclusive, target_tli);
219219

220220
/* cleanup */
221221
parray_walk(backups, pgBackupFree);
@@ -676,7 +676,8 @@ create_recovery_conf(time_t backup_id,
676676
if (target_inclusive)
677677
fprintf(fp, "recovery_target_inclusive = '%s'\n", target_inclusive);
678678

679-
fprintf(fp, "recovery_target_timeline = '%u'\n", target_tli);
679+
if (target_tli)
680+
fprintf(fp, "recovery_target_timeline = '%u'\n", target_tli);
680681

681682
fclose(fp);
682683
}

0 commit comments

Comments
 (0)