Re: Use XLogRecPtrIsValid() instead of negated XLogRecPtrIsInvalid

amul sul <sulamul@gmail.com>

From: Amul Sul <sulamul@gmail.com>
To: vignesh C <vignesh21@gmail.com>
Cc: Fujii Masao <masao.fujii@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2026-04-16T12:30:38Z
Lists: pgsql-hackers
On Thu, Apr 16, 2026 at 4:25 PM vignesh C <vignesh21@gmail.com> wrote:
>
> On Thu, 16 Apr 2026 at 09:42, Fujii Masao <masao.fujii@gmail.com> wrote:
> >
> > On Mon, Apr 13, 2026 at 4:10 PM vignesh C <vignesh21@gmail.com> wrote:
> > > I felt these also should be updated, the attached v2 version patch
> > > includes the changes for the same.
> >
> > Thanks for updating the patch!
> >
> > -       applyPtr = (latestApplyPtr == InvalidXLogRecPtr) ?
> > +       applyPtr = (XLogRecPtrIsInvalid(latestApplyPtr)) ?
> >
> > XLogRecPtrIsValid() should be used here, instead?

The outer parentheses do not seem to be needed, as
XLogRecPtrIsInvalid() already includes them.

Other than that, the v3 patch looks good to me.

Regards,
Amul



Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Use XLogRecPtrIsValid() consistently for WAL position checks

  2. Use XLogRecPtrIsValid() in various places