pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Mark function arguments of type "Datum *" as "const Datum *" whe
Date: Fri, 31 Oct 2025 09:53:38 +0000
Message-ID: <E1vElpC-004NYf-1U@gemulon.postgresql.org> (raw)

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....

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/8a27d418f8fc08b62f371c1b167efbfbf0a2a24e

Modified Files
--------------
doc/src/sgml/spi.sgml                              |  6 +--
src/backend/access/brin/brin_minmax_multi.c        |  2 +-
src/backend/access/hash/hashutil.c                 |  2 +-
src/backend/access/heap/heaptoast.c                |  4 +-
src/backend/access/nbtree/nbtpreprocesskeys.c      |  4 +-
src/backend/access/nbtree/nbtsort.c                |  4 +-
src/backend/access/spgist/spgdoinsert.c            |  2 +-
src/backend/access/spgist/spgtextproc.c            |  2 +-
src/backend/executor/execPartition.c               | 14 +++----
src/backend/executor/nodeIndexscan.c               |  4 +-
src/backend/executor/spi.c                         | 12 +++---
src/backend/partitioning/partbounds.c              |  6 +--
src/backend/partitioning/partprune.c               |  8 ++--
src/backend/statistics/attribute_stats.c           |  4 +-
src/backend/tsearch/ts_selfuncs.c                  |  8 ++--
src/backend/utils/adt/array_selfuncs.c             | 48 +++++++++++-----------
src/backend/utils/adt/arrayfuncs.c                 | 10 ++---
src/backend/utils/adt/json.c                       |  6 +--
src/backend/utils/adt/jsonfuncs.c                  | 28 ++++++-------
src/backend/utils/adt/multirangetypes_selfuncs.c   | 16 ++++----
src/backend/utils/adt/network_selfuncs.c           | 20 ++++-----
src/backend/utils/adt/orderedsetaggs.c             |  4 +-
src/backend/utils/adt/rangetypes_selfuncs.c        | 16 ++++----
src/backend/utils/adt/xml.c                        |  4 +-
src/backend/utils/cache/catcache.c                 | 14 +++----
src/include/access/hash.h                          |  2 +-
src/include/access/heaptoast.h                     |  4 +-
src/include/access/spgist_private.h                |  2 +-
src/include/executor/spi.h                         |  8 ++--
src/include/partitioning/partbounds.h              |  6 +--
src/include/utils/array.h                          | 10 ++---
src/include/utils/jsonb.h                          |  4 +-
src/include/utils/xml.h                            |  4 +-
src/test/modules/spgist_name_ops/spgist_name_ops.c |  2 +-
34 files changed, 145 insertions(+), 145 deletions(-)



Message-ID: <E1vElpC-004NYf-1U@gemulon.postgresql.org>
Permalink:  ../E1vElpC-004NYf-1U@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1vElpC-004NYf-1U@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: peter@eisentraut.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Mark function arguments of type "Datum *" as "const Datum *" whe
  In-Reply-To: <E1vElpC-004NYf-1U@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox