Re: Mark function arguments of type "Datum *" as "const Datum *" where possible - Mailing list pgsql-hackers

From Chao Li
Subject Re: Mark function arguments of type "Datum *" as "const Datum *" where possible
Date
Msg-id CAEoWx2kgP6FVhk-LEufSKxyJU_ysGxgU4+p8hAef67ZvGBRF4A@mail.gmail.com
Whole thread Raw
In response to Re: Mark function arguments of type "Datum *" as "const Datum *" where possible  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers

On Fri, Sep 26, 2025 at 11:00 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
Yeah.  In particular, probably 99% of such Datum arrays also have an
associated array of bool isnull flags.  IMO it makes exactly zero
sense to const-ify the Datums without similar protection for their
isnull flags.


Based on Tom's comment, I have made the scope a little broader. If a function's "Datum *" parameter is changed to const, then if it has a pairing "bool *isnull" parameter, I make it const as well. Also, if the function has other pointer parameters that can be const, I change them to const as well. See v3 attached.

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/
Attachment

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [PATCH] GROUP BY ALL
Next
From: Chao Li
Date:
Subject: Re: Mark function arguments of type "Datum *" as "const Datum *" where possible