Re: new warnings with clang-21 / how const is Datum
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Peter Eisentraut <peter@eisentraut.org>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2025-09-01T15:05:49Z
Lists: pgsql-hackers
Peter Eisentraut <peter@eisentraut.org> writes: > Overall, the question to what extent fmgr functions are allowed to > modify objects pointed to by their input arguments doesn't seem to be > addressed anywhere. I think it's generally understood that an fmgr function must not modify pass-by-reference inputs, because they could easily be pointing directly into a heap tuple in a shared buffer. The exception is functions that participate in custom APIs where the presence of output argument(s) is explicitly documented. One question that statement leaves unanswered is whether datatype input functions qualify as a "custom API". I'd vote not (ie they shouldn't modify their input strings) unless we find exceptions. So that suggests that the use of non-const pointer Datums should be the outlier. regards, tom lane
Commits
-
Some stylistic improvements in toast_save_datum()
- 748caa9dcb68 19 (unreleased) landed
-
Silence compiler warnings on clang 21
- 385c5dfe24de 16.11 landed
- a399db8d5988 17.7 landed
- 14bb47567a39 18.0 landed
- e92677e86333 19 (unreleased) landed
-
Convert *GetDatum() and DatumGet*() macros to inline functions
- c8b2ef05f481 16.0 cited