Re: Improve verification of recovery_target_timeline GUC.

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: David Steele <david@pgbackrest.org>
Cc: Pg Hackers <pgsql-hackers@postgresql.org>
Date: 2025-01-24T06:44:06Z
Lists: pgsql-hackers
On Thu, Jan 23, 2025 at 02:53:39PM +0000, David Steele wrote:
> Currently check_recovery_target_timeline() converts any value that is not
> current, latest, or a valid integer to 0. So for example:
> 
> recovery_target_timeline = 'currrent'
> 
> results in the following error:
> 
> FATAL:  22023: recovery target timeline 0 does not exist

Indeed, that's confusing.  There is nothing telling you what's
actually wrong here, particularly if there is a typo of any kind in
the parameter.

> I discovered this while testing on Postgres versions < 12 where
> The tests are probably excessive but I needed something to show that the
> verification works as expected.

Even with your patch, specifying an incorrect name results in a
complaint about a timeline of 0.  Wouldn't it be better to strengthen
the parsing in check_recovery_target_timeline() and/or the error
message reported?
--
Michael

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Fix constant in error message for recovery_target_timeline

  2. Improve checks for GUC recovery_target_timeline