]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix varatt versus Datum type confusions
authorPeter Eisentraut <peter@eisentraut.org>
Tue, 5 Aug 2025 10:11:36 +0000 (12:11 +0200)
committerPeter Eisentraut <peter@eisentraut.org>
Tue, 5 Aug 2025 10:11:36 +0000 (12:11 +0200)
commit0f5ade7a367c16d823c75a81abb10e2ec98b4206
treedc115967254082955b5bfd12935cf215c3cddc8e
parent2ad6e80de9a6300daffcc0987667e45012fbecde
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
23 files changed:
contrib/hstore/hstore_gin.c
contrib/hstore/hstore_gist.c
contrib/hstore/hstore_io.c
contrib/hstore/hstore_op.c
contrib/test_decoding/test_decoding.c
src/backend/access/brin/brin_minmax_multi.c
src/backend/access/common/heaptuple.c
src/backend/access/common/reloptions.c
src/backend/access/common/toast_internals.c
src/backend/access/gin/gininsert.c
src/backend/access/spgist/spgutils.c
src/backend/access/table/toast_helper.c
src/backend/replication/logical/proto.c
src/backend/replication/pgoutput/pgoutput.c
src/backend/statistics/mcv.c
src/backend/tsearch/ts_selfuncs.c
src/backend/utils/adt/jsonb_gin.c
src/backend/utils/adt/jsonb_op.c
src/backend/utils/adt/jsonfuncs.c
src/backend/utils/adt/jsonpath_exec.c
src/backend/utils/adt/multirangetypes.c
src/backend/utils/adt/rangetypes.c
src/backend/utils/adt/tsvector_op.c