Re: Mark function arguments of type "Datum *" as "const Datum *" where possible

From: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Nathan Bossart <nathandbossart(at)gmail(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Peter Eisentraut <peter(at)eisentraut(dot)org>
Subject: Re: Mark function arguments of type "Datum *" as "const Datum *" where possible
Date: 2025-09-28 03:02:32
Message-ID: CAEoWx2kgP6FVhk-LEufSKxyJU_ysGxgU4+p8hAef67ZvGBRF4A@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Sep 26, 2025 at 11:00 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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 Content-Type Size
v3-0001-Mark-function-arguments-of-type-Datum-as-const-Da.patch application/octet-stream 52.4 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Chao Li 2025-09-28 03:21:10 Re: Mark function arguments of type "Datum *" as "const Datum *" where possible
Previous Message Tom Lane 2025-09-27 22:23:16 Re: [PATCH] GROUP BY ALL