diff options
author | Peter Eisentraut <peter@eisentraut.org> | 2025-08-05 12:11:36 +0200 |
---|---|---|
committer | Peter Eisentraut <peter@eisentraut.org> | 2025-08-05 12:11:36 +0200 |
commit | 0f5ade7a367c16d823c75a81abb10e2ec98b4206 (patch) | |
tree | dc115967254082955b5bfd12935cf215c3cddc8e /src/backend/access/common/toast_internals.c | |
parent | 2ad6e80de9a6300daffcc0987667e45012fbecde (diff) |
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
Diffstat (limited to 'src/backend/access/common/toast_internals.c')
-rw-r--r-- | src/backend/access/common/toast_internals.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/backend/access/common/toast_internals.c b/src/backend/access/common/toast_internals.c index 7d8be8346ce..196e06115e9 100644 --- a/src/backend/access/common/toast_internals.c +++ b/src/backend/access/common/toast_internals.c @@ -144,7 +144,7 @@ toast_save_datum(Relation rel, Datum value, int num_indexes; int validIndex; - Assert(!VARATT_IS_EXTERNAL(value)); + Assert(!VARATT_IS_EXTERNAL(dval)); /* * Open the toast relation and its indexes. We can use the index to check |