| From: | Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com> |
|---|---|
| To: | Peter Eisentraut <peter(at)eisentraut(dot)org> |
| Cc: | Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, Nathan Bossart <nathandbossart(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Michael Paquier <michael(at)paquier(dot)xyz>, Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: Mark function arguments of type "Datum *" as "const Datum *" where possible |
| Date: | 2025-12-09 16:27:04 |
| Message-ID: | aThN2Lfcq6+K+p3i@ip-10-97-1-34.eu-west-3.compute.internal |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| 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(at)sss(dot)pgh(dot)pa(dot)us
> > <mailto: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.
>
> I have committed this.
FWIW, I just submitted a patch [1] that extends this approach to all pointer types.
Regards,
--
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Srinath Reddy Sadipiralla | 2025-12-09 16:27:08 | Re: pg_dump:qemu: uncaught target signal 7 (Bus error) - core dumped |
| Previous Message | Ranier Vilela | 2025-12-09 16:24:14 | Re: Avoid use scoped block variable |