Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit f06588a

Browse files
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
1 parent 793a89c commit f06588a

File tree

1 file changed

+12
-0
lines changed
  • src/backend/access/transam

1 file changed

+12
-0
lines changed

src/backend/access/transam/xlog.c

+12
Original file line numberDiff line numberDiff line change
@@ -5265,6 +5265,18 @@ readRecoveryCommandFile(void)
52655265
{
52665266
recoveryTarget = RECOVERY_TARGET_TIME;
52675267

5268+
if (strcmp(item->value, "epoch") == 0 ||
5269+
strcmp(item->value, "infinity") == 0 ||
5270+
strcmp(item->value, "-infinity") == 0 ||
5271+
strcmp(item->value, "now") == 0 ||
5272+
strcmp(item->value, "today") == 0 ||
5273+
strcmp(item->value, "tomorrow") == 0 ||
5274+
strcmp(item->value, "yesterday") == 0)
5275+
ereport(FATAL,
5276+
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
5277+
errmsg("recovery_target_time is not a valid timestamp: \"%s\"",
5278+
item->value)));
5279+
52685280
/*
52695281
* Convert the time string given by the user to TimestampTz form.
52705282
*/

0 commit comments

Comments
 (0)