Re: Mark ItemPointer parameters as const in tuple/table lock functions

From: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
To: Peter Eisentraut <peter(at)eisentraut(dot)org>
Cc: Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Mark ItemPointer parameters as const in tuple/table lock functions
Date: 2025-08-28 02:30:13
Message-ID: CAEoWx2=-FPRo-5v1f=ZTrLvhhXRvLPFbnyrjzrmPvoSMdRF2tw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Mail Archive always misses attachments sent by Apple Mail. Resending from
the Gmail web client.

Chao Li (Evan)
---------------------
Highgo Software Co., Ltd.
https://www.highgo.com/

Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> 于2025年8月28日周四 10:28写道:

>
>
> On Aug 27, 2025, at 17:24, Peter Eisentraut <peter(at)eisentraut(dot)org> wrote:
>
> This style of having Foo be a type alias for pointer-to-FooData is an
> ancient Postgres coding convention that does not map well to modern C that
> has an emphasis on judicious use of qualifiers and attributes, and so if
> this abstraction gets in the way, we sometimes crack it open, like in the
> case of ItemPointerGetBlockNumber() etc.
>
>
> You are right, we want to protect the stuff that “tid” points to instead
> of “tid” itself:
>
> *tid = something; // should hit compile error
> tid = something; // ok
>
> Also, thanks for telling the history. I have updated the patch to use
> “const ItemPointerData *” in the same way as ItemPointerGetBlockNumber().
>
> Attached is the v2 patch.
>
> Best regards,
> --
> Chao Li (Evan)
> HighGo Software Co., Ltd.
> https://www.highgo.com/
>
>
>
>
>

Attachment Content-Type Size
v2-0001-Mark-ItemPointer-parameters-as-const-in-tuple-tab.patch application/octet-stream 3.8 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Zhijie Hou (Fujitsu) 2025-08-28 02:32:06 RE: Conflict detection for update_deleted in logical replication
Previous Message Chao Li 2025-08-28 02:27:58 Re: Mark ItemPointer parameters as const in tuple/table lock functions