Re: some Page/PageData const stuff

From: Andres Freund <andres(at)anarazel(dot)de>
To: Peter Eisentraut <peter(at)eisentraut(dot)org>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: some Page/PageData const stuff
Date: 2026-01-02 19:17:39
Message-ID: beusplf77varvhip6ryuhd2fchsx26qmmhduqz432bnglq634b@2dx4k6yxj4cm
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2025-01-20 15:01:08 +0100, Peter Eisentraut wrote:
> This has been committed.

I don't like the const markings in PageGetItem():

/*
* PageGetItem
* Retrieves an item on the given page.
*
* Note:
* This does not change the status of any of the resources passed.
* The semantics may change in the future.
*/
static inline void *
PageGetItem(const PageData *page, const ItemIdData *itemId)
{
Assert(page);
Assert(ItemIdHasStorage(itemId));

return (void *) (((const char *) page) + ItemIdGetOffset(itemId));
}

The const for PageData seems like a lie to me, because we cast it away. And
indeed, we often then use the returned value to set hint bits etc.

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Benjamin Leff 2026-01-02 19:46:51 Re: Client-only Meson Build From Sources
Previous Message Kirill Reshke 2026-01-02 19:16:33 Re: GIN pageinspect support for entry tree and posting tree