postgresql/src
Tom Lane 5b8728cd7f Fix NULLIF()'s handling of read-write expanded objects.
If passed a read-write expanded object pointer, the EEOP_NULLIF
code would hand that same pointer to the equality function
and then (unless equality was reported) also return the same
pointer as its value.  This is no good, because a function that
receives a read-write expanded object pointer is fully entitled
to scribble on or even delete the object, thus corrupting the
NULLIF output.  (This problem is likely unobservable with the
equality functions provided in core Postgres, but it's easy to
demonstrate with one coded in plpgsql.)

To fix, make sure the pointer passed to the equality function
is read-only.  We can still return the original read-write
pointer as the NULLIF result, allowing optimization of later
operations.

Per bug #18722 from Alexander Lakhin.  This has been wrong
since we invented expanded objects, so back-patch to all
supported branches.

Discussion: https://postgr.es/m/18722-fd9e645448cc78b4@postgresql.org
2024-11-25 18:09:09 -05:00
..
backend Fix NULLIF()'s handling of read-write expanded objects. 2024-11-25 18:09:09 -05:00
bin pg_dump: Add dumpSchema and dumpData derivative flags. 2024-11-25 16:36:37 -06:00
common Remove unused #include's from bin .c files 2024-11-06 11:11:52 +01:00
fe_utils Remove unused #include's from bin .c files 2024-11-06 11:11:52 +01:00
include Fix NULLIF()'s handling of read-write expanded objects. 2024-11-25 18:09:09 -05:00
interfaces libpq: Improve error message when parsing URI parameters and keywords 2024-11-19 13:27:42 +09:00
makefiles Use __attribute__((target(...))) for AVX-512 support. 2024-11-07 13:58:43 -06:00
pl Add support for Tcl 9 2024-11-25 11:44:29 +01:00
port Support runtime CRC feature probing on NetBSD/ARM using sysctl(). 2024-11-25 11:53:26 -05:00
template thread-safety: gmtime_r(), localtime_r() 2024-08-23 07:43:04 +02:00
test Fix NULLIF()'s handling of read-write expanded objects. 2024-11-25 18:09:09 -05:00
timezone Update time zone data files to tzdata release 2024b. 2024-10-29 11:49:38 -04:00
tools Teach bitmap path generation about transforming OR-clauses to SAOP's 2024-11-24 01:41:45 +02:00
tutorial Update copyright for 2024 2024-01-03 20:49:05 -05:00
.gitignore
DEVELOPERS
Makefile Remove distprep 2023-11-06 15:18:04 +01:00
Makefile.global.in Use __attribute__((target(...))) for AVX-512 support. 2024-11-07 13:58:43 -06:00
Makefile.shlib Remove AIX support 2024-02-28 15:17:23 +04:00
meson.build Update copyright for 2024 2024-01-03 20:49:05 -05:00
nls-global.mk Remove distprep 2023-11-06 15:18:04 +01:00