Re: Improve checks for GUC recovery_target_xid

David Steele <david@pgbackrest.org>

From: David Steele <david@pgbackrest.org>
To: Hüseyin Demir <huseyin.d3r@gmail.com>, pgsql-hackers@lists.postgresql.org, Fujii Masao <masao.fujii@gmail.com>
Date: 2026-03-04T05:07:22Z
Lists: pgsql-hackers

Attachments

Thanks for having a look at this!

On 2/26/26 14:20, Hüseyin Demir wrote:
> 
> The following grammar can be changed by adding "without epoch must be greater than or equal to %u"
> +           GUC_check_errdetail("\"%s\" without epoch must greater than or equal to %u.",
> +                               "recovery_target_xid",
> +                               FirstNormalTransactionId);

Oops - fixed!

> The comment on the lower-bound XID test says # Timeline target out of min range — should be # XID target out of min range.

I have fixed this and made the comments more consistent overall.

> When it comes to *endp validations I suppose the validation passes when we provide   recovery_target_xid = '-1'.  This passes the endp validation and FirstNormalTransactionId checks. Is it a valid approach to allow negative values to this GUC ?
> 
> When -1 is provided the following checks allow them to be a valid GUC.

Yeah, -1 should not be allowed here. I've updated the code to error on 
negative numbers but probably we should import strtou64_strict from the 
front end code or use strtou32_strict, though that needs to be discussed 
separately.

Thanks,
-David

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Improve tests for recovery_target_timeline GUC.

  2. Improve validation of recovery_target_xid GUC values.