From: Peter Eisentraut Date: Tue, 30 Jun 2026 12:03:10 +0000 (+0200) Subject: Fixes for SPI "const Datum *" use X-Git-Tag: REL_19_BETA2~86 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2fb6015f78749c3a235354acded31562414775be;p=thirdparty%2Fpostgresql.git Fixes for SPI "const Datum *" use Fixup for commit 8a27d418f8f, which converted many functions to use "const Datum *" instead of "Datum *", including some SPI functions. For SPI_cursor_open(), the code was updated but not the documentation. For SPI_cursor_open_with_args(), the documentation was updated but not the code. (Possibly, these two were confused with each other.) Also, SPI_execp() and SPI_modifytuple() were not updated, even though they are closely related to the functions touched by the previous commit and now look inconsistent. Fix all these. Reviewed-by: Tom Lane Discussion: https://www.postgresql.org/message-id/flat/86b5162f-c472-40fa-997b-0450dece1dec%40eisentraut.org --- diff --git a/doc/src/sgml/spi.sgml b/doc/src/sgml/spi.sgml index e30d0962ae7..179cceb8da9 100644 --- a/doc/src/sgml/spi.sgml +++ b/doc/src/sgml/spi.sgml @@ -2086,7 +2086,7 @@ int SPI_execute_plan_with_paramlist(SPIPlanPtr plan, -int SPI_execp(SPIPlanPtr plan, Datum * values, const char * nulls, long count) +int SPI_execp(SPIPlanPtr plan, const Datum * values, const char * nulls, long count) @@ -2191,7 +2191,7 @@ int SPI_execp(SPIPlanPtr plan, Datum * values< Portal SPI_cursor_open(const char * name, SPIPlanPtr plan, - Datum * values, const char * nulls, + const Datum * values, const char * nulls, bool read_only) @@ -4694,7 +4694,7 @@ HeapTupleHeader SPI_returntuple(HeapTuple row, TupleDesc HeapTuple SPI_modifytuple(Relation rel, HeapTuple row, int ncols, - int * colnum, Datum * values, const char * nulls) + int * colnum, const Datum * values, const char * nulls) diff --git a/src/backend/executor/spi.c b/src/backend/executor/spi.c index 52f3b11301c..4e52542a3d1 100644 --- a/src/backend/executor/spi.c +++ b/src/backend/executor/spi.c @@ -702,7 +702,7 @@ SPI_execute_plan(SPIPlanPtr plan, const Datum *Values, const char *Nulls, /* Obsolete version of SPI_execute_plan */ int -SPI_execp(SPIPlanPtr plan, Datum *Values, const char *Nulls, long tcount) +SPI_execp(SPIPlanPtr plan, const Datum *Values, const char *Nulls, long tcount) { return SPI_execute_plan(plan, Values, Nulls, false, tcount); } @@ -1105,7 +1105,7 @@ SPI_returntuple(HeapTuple tuple, TupleDesc tupdesc) HeapTuple SPI_modifytuple(Relation rel, HeapTuple tuple, int natts, int *attnum, - Datum *Values, const char *Nulls) + const Datum *Values, const char *Nulls) { MemoryContext oldcxt; HeapTuple mtuple; @@ -1473,7 +1473,7 @@ Portal SPI_cursor_open_with_args(const char *name, const char *src, int nargs, Oid *argtypes, - Datum *Values, const char *Nulls, + const Datum *Values, const char *Nulls, bool read_only, int cursorOptions) { Portal result; diff --git a/src/include/executor/spi.h b/src/include/executor/spi.h index f4985cb715d..fd79f86a98c 100644 --- a/src/include/executor/spi.h +++ b/src/include/executor/spi.h @@ -119,7 +119,7 @@ extern int SPI_execute_plan_with_paramlist(SPIPlanPtr plan, ParamListInfo params, bool read_only, long tcount); extern int SPI_exec(const char *src, long tcount); -extern int SPI_execp(SPIPlanPtr plan, Datum *Values, const char *Nulls, +extern int SPI_execp(SPIPlanPtr plan, const Datum *Values, const char *Nulls, long tcount); extern int SPI_execute_snapshot(SPIPlanPtr plan, const Datum *Values, const char *Nulls, @@ -155,7 +155,7 @@ extern CachedPlan *SPI_plan_get_cached_plan(SPIPlanPtr plan); extern HeapTuple SPI_copytuple(HeapTuple tuple); extern HeapTupleHeader SPI_returntuple(HeapTuple tuple, TupleDesc tupdesc); extern HeapTuple SPI_modifytuple(Relation rel, HeapTuple tuple, int natts, - int *attnum, Datum *Values, const char *Nulls); + int *attnum, const Datum *Values, const char *Nulls); extern int SPI_fnumber(TupleDesc tupdesc, const char *fname); extern char *SPI_fname(TupleDesc tupdesc, int fnumber); extern char *SPI_getvalue(HeapTuple tuple, TupleDesc tupdesc, int fnumber); @@ -176,7 +176,7 @@ extern Portal SPI_cursor_open(const char *name, SPIPlanPtr plan, extern Portal SPI_cursor_open_with_args(const char *name, const char *src, int nargs, Oid *argtypes, - Datum *Values, const char *Nulls, + const Datum *Values, const char *Nulls, bool read_only, int cursorOptions); extern Portal SPI_cursor_open_with_paramlist(const char *name, SPIPlanPtr plan, ParamListInfo params, bool read_only);