Re: Remove unneeded cast in heap_xlog_lock. - Mailing list pgsql-hackers

From Kirill Reshke
Subject Re: Remove unneeded cast in heap_xlog_lock.
Date
Msg-id CALdSSPhCoLBj33HrE9eOYtz7J2kfdbKtk_p8ej8u8jZ-oTGOYQ@mail.gmail.com
Whole thread Raw
In response to Re: Remove unneeded cast in heap_xlog_lock.  (Peter Eisentraut <peter@eisentraut.org>)
List pgsql-hackers
On Sat, 23 Aug 2025 at 19:57, Peter Eisentraut <peter@eisentraut.org> wrote:
>
> On 22.08.25 11:59, Álvaro Herrera wrote:
> > On 2025-Aug-22, Kirill Reshke wrote:
> >
> >> I am uncertain about the delineation between when we make changes and
> >> when we refrain from doing so.
> >
> > I think this is natural work after 9c727360bcc7, before which
> > BufferGetPage() was a macro and strangely enough had its own cast
> > embedded.  As I understand, the less casts we have, the better.  There's
> > some other standardization work going on to remove unnecessary casts
> > elsewhere, so I'm not sure why we wouldn't do this.
>
> In the very first code import, BufferGetPage() was a regular function
> that returned Page.  (I suppose it was then turned into a macro, and
> then back into an inline function.)  Even in that first code import,
> some callers cast the return to (Page), and some not.  So I suppose this
> style just crept in for some random and ancient reason and then got
> copied around inconsistently.

Thank you for clarifications.

> We should clean it up.  Casts are bad.

I created CF [0] for this.

[0] https://commitfest.postgresql.org/patch/6006/


--
Best regards,
Kirill Reshke



pgsql-hackers by date:

Previous
From: Nisha Moond
Date:
Subject: Re: Avoid retaining conflict-related data when no tables are subscribed
Next
From: Xuneng Zhou
Date:
Subject: Re: Improve read_local_xlog_page_guts by replacing polling with latch-based waiting