EnterpriseDB / barman

Barman - Backup and Recovery Manager for PostgreSQL
https://www.pgbarman.org/
GNU General Public License v3.0
2.07k stars 191 forks source link

Always add an explicit time zone to `recovery_target_time` #945

Closed barthisrael closed 3 months ago

barthisrael commented 3 months ago

Previous to this commit there could be cases where Postgres would be misconfigured by barman recover.

For example, assume you had an environment like this:

If we attempted a barman recover execution with --target-time set, but without an explicit time zone, recovery could fail:

In practice either the recovery would fail because of an invalid recovery target, or the cluster would be recovered to a point-in-time different from the user needs. Neither of these cases are welcome.

This commit fixes that issue by reusing the target_datetime key from the recovery_info variable. That entry contains the target time with a time zone explicitly set, even if the user specified no time zone through the command-line option.

Note: a warning is issued if the user specified no time zone, and Barman assumed its host time zone.

References: BAR-185 #881.