postgresql/src
Tom Lane 309857f9c1 Fix handling of R/W expanded datums that are passed to SQL functions.
fmgr_sql must make expanded-datum arguments read-only, because
it's possible that the function body will pass the argument to
more than one callee function.  If one of those functions takes
the datum's R/W property as license to scribble on it, then later
callees will see an unexpected value, leading to wrong answers.

From a performance standpoint, it'd be nice to skip this in the
common case that the argument value is passed to only one callee.
However, detecting that seems fairly hard, and certainly not
something that I care to attempt in a back-patched bug fix.

Per report from Adam Mackler.  This has been broken since we
invented expanded datums, so back-patch to all supported branches.

Discussion: https://postgr.es/m/WScDU5qfoZ7PB2gXwNqwGGgDPmWzz08VdydcPFLhOwUKZcdWbblbo-0Lku-qhuEiZoXJ82jpiQU4hOjOcrevYEDeoAvz6nR0IU4IHhXnaCA=@mackler.email
Discussion: https://postgr.es/m/187436.1660143060@sss.pgh.pa.us
2022-08-10 13:37:25 -04:00
..
backend Fix handling of R/W expanded datums that are passed to SQL functions. 2022-08-10 13:37:25 -04:00
bin Remove unused short option from getopt_long() call 2022-08-10 12:02:32 +03:00
common Replace pgwin32_is_junction() with lstat(). 2022-08-06 12:50:59 +12:00
fe_utils Fix mismatched file identifications 2022-08-09 09:21:37 +07:00
include Introduce optimized routine for linear searches of arrays 2022-08-10 10:48:29 +07:00
interfaces Remove fallbacks for strtoll, strtoull. 2022-08-06 09:59:51 +12:00
makefiles solaris: Remove unnecessary gcc / gnu ld vs sun studio differences 2022-08-07 09:36:01 -07:00
pl Add PGDLLEXPORTS to some plpgsql function declarations 2022-07-20 10:24:50 +02:00
port Simplify replacement code for strtof. 2022-08-07 12:42:41 +12:00
template aix: Remove checks for very old OS versions 2022-08-07 09:36:01 -07:00
test Fix handling of R/W expanded datums that are passed to SQL functions. 2022-08-10 13:37:25 -04:00
timezone Remove fallbacks for strtoll, strtoull. 2022-08-06 09:59:51 +12:00
tools Fix MSVC build script's check for obsolete node support functions. 2022-08-08 14:43:35 -04:00
tutorial Update copyright for 2022 2022-01-07 19:04:57 -05:00
.gitignore
DEVELOPERS
Makefile Remove the option to build thread_test.c outside configure. 2020-10-21 12:08:48 -04:00
Makefile.global.in windows: Remove HAVE_MINIDUMP_TYPE test 2022-08-07 09:36:01 -07:00
Makefile.shlib solaris: Remove unnecessary gcc / gnu ld vs sun studio differences 2022-08-07 09:36:01 -07:00
nls-global.mk Fix for make unportability 2022-07-13 09:15:01 +02:00