diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index df4843f409..442341a707 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -5265,6 +5265,18 @@ readRecoveryCommandFile(void)
 		{
 			recoveryTarget = RECOVERY_TARGET_TIME;
 
+			if (strcmp(item->value, "epoch") == 0 ||
+				strcmp(item->value, "infinity") == 0 ||
+				strcmp(item->value, "-infinity") == 0 ||
+				strcmp(item->value, "now") == 0 ||
+				strcmp(item->value, "today") == 0 ||
+				strcmp(item->value, "tomorrow") == 0 ||
+				strcmp(item->value, "yesterday") == 0)
+				ereport(FATAL,
+						(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+						 errmsg("recovery_target_time is not a valid timestamp: \"%s\"",
+								item->value)));
+
 			/*
 			 * Convert the time string given by the user to TimestampTz form.
 			 */
