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: Fix varatt versus Datum type confusions
Date: Tue, 05 Aug 2025 10:15:58 +0000
Message-ID: <E1ujEi6-000rEO-0m@gemulon.postgresql.org> (raw)

Fix varatt versus Datum type confusions

Macros like VARDATA() and VARSIZE() should be thought of as taking
values of type pointer to struct varlena or some other related struct.
The way they are implemented, you can pass anything to it and it will
cast it right.  But this is in principle incorrect.  To fix, add the
required DatumGetPointer() calls.  Or in a couple of cases, remove
superfluous PointerGetDatum() calls.

It is planned in a subsequent patch to change macros like VARDATA()
and VARSIZE() to inline functions, which will enforce stricter typing.
This is in preparation for that.

Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://www.postgresql.org/message-id/flat/928ea48f-77c6-417b-897c-621ef16685a6%40eisentraut.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/0f5ade7a367c16d823c75a81abb10e2ec98b4206

Modified Files
--------------
contrib/hstore/hstore_gin.c                 |  2 +-
contrib/hstore/hstore_gist.c                |  4 ++--
contrib/hstore/hstore_io.c                  | 24 ++++++++++++------------
contrib/hstore/hstore_op.c                  |  4 ++--
contrib/test_decoding/test_decoding.c       |  2 +-
src/backend/access/brin/brin_minmax_multi.c |  2 +-
src/backend/access/common/heaptuple.c       |  8 ++++----
src/backend/access/common/reloptions.c      |  8 ++++----
src/backend/access/common/toast_internals.c |  2 +-
src/backend/access/gin/gininsert.c          |  2 +-
src/backend/access/spgist/spgutils.c        |  4 ++--
src/backend/access/table/toast_helper.c     |  2 +-
src/backend/replication/logical/proto.c     |  2 +-
src/backend/replication/pgoutput/pgoutput.c |  4 ++--
src/backend/statistics/mcv.c                |  2 +-
src/backend/tsearch/ts_selfuncs.c           |  2 +-
src/backend/utils/adt/jsonb_gin.c           |  4 ++--
src/backend/utils/adt/jsonb_op.c            |  8 ++++----
src/backend/utils/adt/jsonfuncs.c           |  4 ++--
src/backend/utils/adt/jsonpath_exec.c       |  4 ++--
src/backend/utils/adt/multirangetypes.c     |  7 ++++---
src/backend/utils/adt/rangetypes.c          |  6 ++----
src/backend/utils/adt/tsvector_op.c         | 24 ++++++++++++------------
23 files changed, 65 insertions(+), 66 deletions(-)



Message-ID: <E1ujEi6-000rEO-0m@gemulon.postgresql.org>
Permalink:  ../E1ujEi6-000rEO-0m@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1ujEi6-000rEO-0m@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: Fix varatt versus Datum type confusions
  In-Reply-To: <E1ujEi6-000rEO-0m@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