| From: | Ewan Young <kdbase(dot)hack(at)gmail(dot)com> |
|---|---|
| To: | Peter Eisentraut <peter(at)eisentraut(dot)org> |
| Cc: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: Make SPI_prepare argtypes argument const |
| Date: | 2026-06-11 09:59:55 |
| Message-ID: | CAON2xHM18ieNfgZ69xTqSdqFp=KSoycKijErgchzbfFDDjRipw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Reviewed this. LGTM.
I checked that argtypes / param_types is only ever read or copied along
this path (never written or freed through the pointer), so const-qualifying
it is sound rather than merely tolerated. In particular CompleteCachedPlan()
palloc's its own copy and never retains the caller's array. pg_analyze_and_
rewrite_fixedparams() already takes const Oid *, so no further change is
needed there.
Applies cleanly on HEAD and builds without warnings here.
On Thu, Jun 11, 2026 at 5:22 PM Peter Eisentraut <peter(at)eisentraut(dot)org> wrote:
>
> This changes the argtypes argument of SPI_prepare(),
> SPI_prepare_cursor(), SPI_cursor_open_with_args(), and
> SPI_execute_with_args() from Oid *argtypes to const Oid *argtypes.
> The underlying functions were already receptive to that, so this
> doesn't require any significant changes beyond the function signatures
> and some internal variables.
>
> Commit 28972b6fc3dc recently introduced a case where a const had to be
> cast away before calling these functions. This is fixed here.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | solai v | 2026-06-11 10:31:36 | Re: extend JSON_TABLE top level path expression |
| Previous Message | Michael Paquier | 2026-06-11 09:53:19 | Re: t/035_standby_logical_decoding.pl might fail on attempt to read wrong timeline |