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 <[email protected]> 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.
