diff options
author | Simon Riggs <simon@2ndQuadrant.com> | 2017-09-07 04:56:34 -0700 |
---|---|---|
committer | Simon Riggs <simon@2ndQuadrant.com> | 2017-09-07 04:56:34 -0700 |
commit | f06588a8e6d1e2bf56f9dfa58d97e7956050ddc7 (patch) | |
tree | c164c4d23f7051f2397f860baa9033a9af77ffd6 /src/backend/access/transam/xlog.c | |
parent | 793a89c1966733c84edacaa25ce47b72a75f3afb (diff) | |
download | postgresql-f06588a8e6d1e2bf56f9dfa58d97e7956050ddc7.tar.gz postgresql-f06588a8e6d1e2bf56f9dfa58d97e7956050ddc7.zip |
Exclude special values in recovery_target_time
recovery_target_time accepts timestamp input, though
does not allow use of special values, e.g. “today”.
Report a useful error message for these cases.
Reported-by: Piotr Stefaniak
Author: Simon Riggs
Discussion: https://postgr.es/m/CANP8+jJdKA+BkkYLWz9zAm16Y0s2ExBv0WfpAwXdTpPfWnA9Bg@mail.gmail.com
Diffstat (limited to 'src/backend/access/transam/xlog.c')
-rw-r--r-- | src/backend/access/transam/xlog.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index df4843f4093..442341a707e 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. */ |