From 8a27d418f8fc08b62f371c1b167efbfbf0a2a24e Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Fri, 31 Oct 2025 10:45:02 +0100 Subject: Mark function arguments of type "Datum *" as "const Datum *" where possible Several functions in the codebase accept "Datum *" parameters but do not modify the pointed-to data. These have been updated to take "const Datum *" instead, improving type safety and making the interfaces clearer about their intent. This change helps the compiler catch accidental modifications and better documents immutability of arguments. Most of "Datum *" parameters have a pairing "bool *isnull" parameter, they are constified as well. No functional behavior is changed by this patch. Author: Chao Li Discussion: https://www.postgresql.org/message-id/flat/CAEoWx2msfT0knvzUa72ZBwu9LR_RLY4on85w2a9YpE-o2By5HQ@mail.gmail.com --- src/include/executor/spi.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/include/executor') diff --git a/src/include/executor/spi.h b/src/include/executor/spi.h index d064d1a9b76..de516e5700a 100644 --- a/src/include/executor/spi.h +++ b/src/include/executor/spi.h @@ -111,7 +111,7 @@ extern int SPI_finish(void); extern int SPI_execute(const char *src, bool read_only, long tcount); extern int SPI_execute_extended(const char *src, const SPIExecuteOptions *options); -extern int SPI_execute_plan(SPIPlanPtr plan, Datum *Values, const char *Nulls, +extern int SPI_execute_plan(SPIPlanPtr plan, const Datum *Values, const char *Nulls, bool read_only, long tcount); extern int SPI_execute_plan_extended(SPIPlanPtr plan, const SPIExecuteOptions *options); @@ -122,13 +122,13 @@ extern int SPI_exec(const char *src, long tcount); extern int SPI_execp(SPIPlanPtr plan, Datum *Values, const char *Nulls, long tcount); extern int SPI_execute_snapshot(SPIPlanPtr plan, - Datum *Values, const char *Nulls, + const Datum *Values, const char *Nulls, Snapshot snapshot, Snapshot crosscheck_snapshot, bool read_only, bool fire_triggers, long tcount); extern int SPI_execute_with_args(const char *src, int nargs, Oid *argtypes, - Datum *Values, const char *Nulls, + const Datum *Values, const char *Nulls, bool read_only, long tcount); extern SPIPlanPtr SPI_prepare(const char *src, int nargs, Oid *argtypes); extern SPIPlanPtr SPI_prepare_cursor(const char *src, int nargs, Oid *argtypes, @@ -172,7 +172,7 @@ extern void SPI_freetuple(HeapTuple tuple); extern void SPI_freetuptable(SPITupleTable *tuptable); extern Portal SPI_cursor_open(const char *name, SPIPlanPtr plan, - Datum *Values, const char *Nulls, bool read_only); + const Datum *Values, const char *Nulls, bool read_only); extern Portal SPI_cursor_open_with_args(const char *name, const char *src, int nargs, Oid *argtypes, -- cgit v1.2.3