Re: [HACKERS] recovery_target_time = 'now' is not an error but stillimpractical setting - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: [HACKERS] recovery_target_time = 'now' is not an error but stillimpractical setting
Date
Msg-id CAB7nPqTiD58uKmQR8Vjwj2d+wnnHM+VB_J+-kg3c5FCwLM-suw@mail.gmail.com
Whole thread Raw
In response to Re: [HACKERS] recovery_target_time = 'now' is not an error but stillimpractical setting  (Simon Riggs <simon@2ndquadrant.com>)
Responses Re: [HACKERS] recovery_target_time = 'now' is not an error but stillimpractical setting  (Simon Riggs <simon@2ndquadrant.com>)
List pgsql-hackers
On Thu, Aug 17, 2017 at 6:24 PM, Simon Riggs <simon@2ndquadrant.com> wrote:
> On 15 August 2017 at 15:37, Piotr Stefaniak <postgres@piotr-stefaniak.me> wrote:
>
>> One thing I tried was a combination of recovery_target_action =
>> 'shutdown' and recovery_target_time = 'now'. The result is surprising
>
> Indeed, special timestamp values were never considered in the design,
> so I'm not surprised they don't work and have never been tested.

We could always use a TRY/CATCH block and add an error in
GetCurrentDateTime and GetCurrentTimeUsec if they are called out of a
transaction context. Rather-safe-than-sorry.

> Your suggestion of "furthest" is already the default behaviour.
>
> Why are you using 'now'? Why would you want to pick a randomly
> selected end time?

"now" is not much interesting, targets in the past are more, like
'yesterday'. This could create back an instance back to the beginning
of the previous day, simplifying scripts creating recovery.conf a bit,
even if that's not much simplification as we are talking about
creating a timestamp string.

> recovery_target_time = 'allballs' sounds fun for recovering corrupted databases

This one would not work :)
=# select timestamptz_in('allballs', 0, 0);
ERROR:  22007: invalid input syntax for type timestamp with time zone:
"allballs"
LOCATION:  DateTimeParseError, datetime.c:3800
Still that would be fun.
-- 
Michael



pgsql-hackers by date:

Previous
From: Mithun Cy
Date:
Subject: Re: [HACKERS] Proposal : For Auto-Prewarm.
Next
From: Andrey Borodin
Date:
Subject: Re: [HACKERS] [PROPOSAL] Use SnapshotAny in get_actual_variable_range