diff -rpcd a/doc/src/sgml/recovery-config.sgml b/doc/src/sgml/recovery-config.sgml *** a/doc/src/sgml/recovery-config.sgml 2013-12-02 09:17:05.000000000 +0900 --- b/doc/src/sgml/recovery-config.sgml 2013-12-09 16:15:10.000000000 +0900 *************** restore_command = 'copy "C:\\server\\arc *** 165,171 **** recovery_target_time ! (timestamp) recovery_target_time recovery parameter --- 165,171 ---- recovery_target_time ! (string) recovery_target_time recovery parameter *************** restore_command = 'copy "C:\\server\\arc *** 177,182 **** --- 177,184 ---- At most one of recovery_target_time, or can be specified. + Setting this to backup_point recovers to the time when + the base backup completed. The default is to recover to the end of the WAL log. The precise stopping point is also influenced by . diff -rpcd a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c *** a/src/backend/access/transam/xlog.c 2013-12-02 09:17:05.000000000 +0900 --- b/src/backend/access/transam/xlog.c 2013-12-09 16:15:27.000000000 +0900 *************** readRecoveryCommandFile(void) *** 5403,5408 **** --- 5403,5416 ---- continue; recoveryTarget = RECOVERY_TARGET_TIME; + if (strcmp(item->value, "backup_point") == 0) + { + recoveryTargetTime = 0; + ereport(DEBUG2, + (errmsg_internal("recovery_target_time = backup_point"))); + continue; + } + /* * Convert the time string given by the user to TimestampTz form. */ *************** exitArchiveRecovery(TimeLineID endTLI, X *** 5628,5634 **** static bool recoveryStopsHere(XLogRecord *record, bool *includeThis) { ! bool stopsHere; uint8 record_info; TimestampTz recordXtime; char recordRPName[MAXFNAMELEN]; --- 5636,5642 ---- static bool recoveryStopsHere(XLogRecord *record, bool *includeThis) { ! bool stopsHere = false; /* to keep compiler quiet */ uint8 record_info; TimestampTz recordXtime; char recordRPName[MAXFNAMELEN]; *************** recoveryStopsHere(XLogRecord *record, bo *** 5710,5716 **** */ *includeThis = false; } ! else { /* * There can be many transactions that share the same commit time, so --- 5718,5724 ---- */ *includeThis = false; } ! else if (recoveryTargetTime != 0) { /* * There can be many transactions that share the same commit time, so *************** StartupXLOG(void) *** 6107,6112 **** --- 6115,6124 ---- ereport(LOG, (errmsg("starting point-in-time recovery to XID %u", recoveryTargetXid))); + else if (recoveryTarget == RECOVERY_TARGET_TIME && + recoveryTargetTime == 0) + ereport(LOG, + (errmsg("starting point-in-time recovery to backup point"))); else if (recoveryTarget == RECOVERY_TARGET_TIME) ereport(LOG, (errmsg("starting point-in-time recovery to %s", *************** StartupXLOG(void) *** 6842,6847 **** --- 6854,6875 ---- if (switchedTLI && AllowCascadeReplication()) WalSndWakeup(); + /* + * If we have reached the end of base backup during recovery + * to the backup point, exit redo loop. + */ + if (recoveryTarget == RECOVERY_TARGET_TIME && + recoveryTargetTime == 0 && reachedConsistency) + { + if (recoveryPauseAtTarget) + { + SetRecoveryPause(true); + recoveryPausesHere(); + } + reachedStopPoint = true; + break; + } + /* Exit loop if we reached inclusive recovery target */ if (!recoveryContinue) break; *************** StartupXLOG(void) *** 6978,6983 **** --- 7006,7014 ---- "%s transaction %u", recoveryStopAfter ? "after" : "before", recoveryStopXid); + else if (recoveryTarget == RECOVERY_TARGET_TIME && + recoveryStopTime == 0) + snprintf(reason, sizeof(reason), "at backup point"); else if (recoveryTarget == RECOVERY_TARGET_TIME) snprintf(reason, sizeof(reason), "%s %s\n",