Re: Mark function arguments of type "Datum *" as "const Datum *" where possible
Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
From: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
To: Peter Eisentraut <peter@eisentraut.org>
Cc: Chao Li <li.evan.chao@gmail.com>, Nathan Bossart <nathandbossart@gmail.com>, Tom Lane <tgl@sss.pgh.pa.us>, Michael Paquier <michael@paquier.xyz>, Postgres hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-12-09T16:27:04Z
Lists: pgsql-hackers
Hi, On Fri, Oct 31, 2025 at 10:56:35AM +0100, Peter Eisentraut wrote: > On 28.09.25 05:02, Chao Li wrote: > > > > On Fri, Sep 26, 2025 at 11:00 PM Tom Lane <tgl@sss.pgh.pa.us > > <mailto: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. > > I have committed this. FWIW, I just submitted a patch [1] that extends this approach to all pointer types. [1]: https://www.postgresql.org/message-id/flat/aThMaTPjSeFq3qTf@ip-10-97-1-34.eu-west-3.compute.internal Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Mark function arguments of type "Datum *" as "const Datum *" where possible
- 8a27d418f8fc 19 (unreleased) landed