postgres/src
Tom Lane 0f43083d16 functions.c: copy trees from source_list before parse analysis etc.
This is yet another bit of fallout from the fact that backend/parser
(like other code) feels free to scribble on the parse tree it's
handed.  In this case that resulted in modifying the
relatively-short-lived copy in the cached function's source_list.
That would be fine since we only need each source_list tree once
... except that if the parser fails after making some changes,
the function cache entry remains as-is and will still be there
if the user tries to execute the function again.  Then we have
problems because we're feeding a non-pristine tree to the parser.

The most expedient fix is a quick copyObject().  I considered
other answers like somehow marking the cache entry invalid
temporarily, but that would add complexity and I'm not sure
it's worth it.  In typical scenarios we'd only do this once
per function query per session.

Reported-by: Alexander Lakhin <exclusion@gmail.com>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/6d442183-102c-498a-81d1-eeeb086cdc5a@gmail.com
2025-04-04 18:26:51 -04:00
..
backend functions.c: copy trees from source_list before parse analysis etc. 2025-04-04 18:26:51 -04:00
bin Fix a couple of error messages and tests for them 2025-04-04 17:07:45 -04:00
common Update Unicode data to Unicode 16.0.0 2025-04-03 12:00:09 +02:00
fe_utils add new list type simple_oid_string_list to fe-utils/simple_list 2025-04-04 16:01:22 -04:00
include add new list type simple_oid_string_list to fe-utils/simple_list 2025-04-04 16:01:22 -04:00
interfaces oauth: Fix build on platforms without epoll/kqueue 2025-04-03 20:37:52 +02:00
makefiles aio: Add liburing dependency 2025-03-26 19:45:32 -04:00
pl plpython: Add test for returning Python set from SETOF function 2025-04-03 11:09:50 +02:00
port Add timingsafe_bcmp(), for constant-time memory comparison 2025-04-02 15:32:40 +03:00
template
test Avoid extra index searches through preprocessing. 2025-04-04 14:14:08 -04:00
timezone pg_noreturn to replace pg_attribute_noreturn() 2025-03-13 12:37:26 +01:00
tools add new list type simple_oid_string_list to fe-utils/simple_list 2025-04-04 16:01:22 -04:00
tutorial Doc: simplify the tutorial's window-function examples. 2025-01-21 14:43:21 -05:00
.gitignore
DEVELOPERS
Makefile
Makefile.global.in Update Unicode data to Unicode 16.0.0 2025-04-03 12:00:09 +02:00
Makefile.shlib
meson.build Update copyright for 2025 2025-01-01 11:21:55 -05:00
nls-global.mk