summaryrefslogtreecommitdiff
path: root/src/include/executor
diff options
context:
space:
mode:
authorPeter Eisentraut <peter@eisentraut.org>2025-10-31 10:45:02 +0100
committerPeter Eisentraut <peter@eisentraut.org>2025-10-31 10:47:25 +0100
commit8a27d418f8fc08b62f371c1b167efbfbf0a2a24e (patch)
tree414b7c6d0f4813aadb4b80f41774131180fe867e /src/include/executor
parentaa4535307e3d432f44b4c76b8ffebc5a0789250c (diff)
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 <lic@highgo.com> Discussion: https://www.postgresql.org/message-id/flat/CAEoWx2msfT0knvzUa72ZBwu9LR_RLY4on85w2a9YpE-o2By5HQ@mail.gmail.com
Diffstat (limited to 'src/include/executor')
-rw-r--r--src/include/executor/spi.h8
1 files changed, 4 insertions, 4 deletions
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,