@@ -5228,7 +5228,7 @@ readRecoveryCommandFile(void)
52285228if (strlen (recoveryTargetName ) >=MAXFNAMELEN )
52295229ereport (FATAL ,
52305230(errcode (ERRCODE_INVALID_PARAMETER_VALUE ),
5231- errmsg ("recovery_target_name is too long" )));
5231+ errmsg ("recovery_target_name is too long (maximum %d characters)" , MAXFNAMELEN - 1 )));
52325232
52335233ereport (DEBUG2 ,
52345234(errmsg ("recovery_target_name = '%s'" ,
@@ -5448,7 +5448,7 @@ exitArchiveRecovery(TimeLineID endTLI, uint32 endLogId, uint32 endLogSeg)
54485448 * Returns TRUE if we are stopping, FALSE otherwise. On TRUE return,
54495449 * *includeThis is set TRUE if we should apply this record before stopping.
54505450 *
5451- * We also track the timestamp of the latest applied COMMIT/ABORT/RESTORE POINT
5451+ * We also track the timestamp of the latest applied COMMIT/ABORT
54525452 * record in XLogCtl->recoveryLastXTime, for logging purposes.
54535453 * Also, some information is saved in recoveryStopXid et al for use in
54545454 * annotating the new timeline's history file.
@@ -5493,14 +5493,19 @@ recoveryStopsHere(XLogRecord *record, bool *includeThis)
54935493/* Do we have a PITR target at all? */
54945494if (recoveryTarget == RECOVERY_TARGET_UNSET )
54955495{
5496- SetLatestXTime (recordXtime );
5496+ /*
5497+ * Save timestamp of latest transaction commit/abort if this is
5498+ * a transaction record
5499+ */
5500+ if (record -> xl_rmid == RM_XACT_ID )
5501+ SetLatestXTime (recordXtime );
54975502return false;
54985503}
54995504
55005505if (recoveryTarget == RECOVERY_TARGET_XID )
55015506{
55025507/*
5503- *there can be only one transaction end record with this exact
5508+ *There can be only one transaction end record with this exact
55045509 * transactionid
55055510 *
55065511 * when testing for an xid, we MUST test for equality only, since
@@ -5515,21 +5520,21 @@ recoveryStopsHere(XLogRecord *record, bool *includeThis)
55155520else if (recoveryTarget == RECOVERY_TARGET_NAME )
55165521{
55175522/*
5518- *there can be many restore points that share the same name, so we stop
5523+ *There can be many restore points that share the same name, so we stop
55195524 * at the first one
55205525 */
55215526stopsHere = (strcmp (recordRPName ,recoveryTargetName )== 0 );
55225527
55235528/*
5524- *ignore recoveryTargetInclusive because this is not a transaction
5529+ *Ignore recoveryTargetInclusive because this is not a transaction
55255530 * record
55265531 */
55275532* includeThis = false;
55285533}
55295534else
55305535{
55315536/*
5532- *there can be many transactions that share the same commit time, so
5537+ *There can be many transactions that share the same commit time, so
55335538 * we stop after the last one, if we are inclusive, or stop at the
55345539 * first one if we are exclusive
55355540 */
@@ -5583,10 +5588,15 @@ recoveryStopsHere(XLogRecord *record, bool *includeThis)
55835588timestamptz_to_str (recoveryStopTime ))));
55845589}
55855590
5586- if (recoveryStopAfter )
5591+ /*
5592+ * Note that if we use a RECOVERY_TARGET_TIME then we can stop
5593+ * at a restore point since they are timestamped, though the latest
5594+ * transaction time is not updated.
5595+ */
5596+ if (record -> xl_rmid == RM_XACT_ID && recoveryStopAfter )
55875597SetLatestXTime (recordXtime );
55885598}
5589- else
5599+ else if ( record -> xl_rmid == RM_XACT_ID )
55905600SetLatestXTime (recordXtime );
55915601
55925602return stopsHere ;
@@ -9220,7 +9230,7 @@ pg_create_restore_point(PG_FUNCTION_ARGS)
92209230if (strlen (restore_name_str ) >=MAXFNAMELEN )
92219231ereport (ERROR ,
92229232(errcode (ERRCODE_INVALID_PARAMETER_VALUE ),
9223- errmsg ("value too long for restore point" )));
9233+ errmsg ("value too long for restore point (maximum %d characters)" , MAXFNAMELEN - 1 )));
92249234
92259235restorepoint = XLogRestorePoint (restore_name_str );
92269236