postgresql/src/backend
Tom Lane 5dfc2b753b Prevent clobbering of utility statements in SQL function caches.
This is an oversight in commit 7c337b6b5: I apparently didn't think
about the possibility of a SQL function being executed multiple
times within a query.  In that case, functions.c's primitive caching
mechanism allows the same utility parse tree to be presented for
execution more than once.  We have to tell ProcessUtility to make
a working copy of the parse tree, or bad things happen.

Normally I'd add a regression test, but I think the reported crasher
is dependent on some rather random implementation choices that are
nowhere near functions.c, so its usefulness as a long-lived test
feels questionable.  In any case, this fix is clearly correct given
the design choices of 7c337b6b5.

Per bug #17702 from Xin Wen.  Thanks to Daniel Gustafsson for
analysis.  Back-patch to v14 where the faulty commit came in
(before that, the responsibility for copying scribble-able
utility parse trees lay elsewhere).

Discussion: https://postgr.es/m/17702-ad24fdcdd1e9047a@postgresql.org
2022-11-29 11:46:33 -05:00
..
access Make multixact error message more explicit 2022-11-24 10:45:10 +01:00
backup Message style improvements 2022-09-24 18:38:35 -04:00
bootstrap Process session_preload_libraries within InitPostgres's transaction. 2022-07-25 10:27:43 -04:00
catalog Avoid crash after function syntax error in a replication worker. 2022-11-03 12:01:57 -04:00
commands Fix CREATE DATABASE so we can pg_upgrade DBs with OIDs above 2^31. 2022-11-04 10:39:52 -04:00
executor Prevent clobbering of utility statements in SQL function caches. 2022-11-29 11:46:33 -05:00
foreign Rename SetSingleFuncCall() to InitMaterializedSRF() 2022-10-18 10:22:40 +09:00
jit Track LLVM 15 changes. 2022-10-19 22:18:54 +13:00
lib Fix lock assertions in dshash.c. 2022-07-11 16:01:22 +12:00
libpq Remove misguided SSL key file ownership check in libpq. 2022-05-26 14:14:05 -04:00
main Fix outdated --help message for postgres -f 2022-08-15 13:37:32 +09:00
nodes Fix pg_stat_statements for MERGE 2022-09-27 10:44:42 +02:00
optimizer Remove bogus Assert and dead code in remove_useless_results_recurse(). 2022-11-29 10:52:44 -05:00
parser Fix rule-detection code for MERGE. 2022-11-25 13:29:51 +00:00
partitioning Small cleanup of create_list_bounds() 2022-07-13 17:01:39 +12:00
po Translation updates 2022-11-07 19:22:54 +01:00
port Ensure that the argument of shmdt(2) is declared "void *". 2022-02-15 17:17:28 -05:00
postmaster Rework shutdown callback of archiver modules 2022-10-19 14:07:01 +09:00
regex Defend against stack overrun in a few more places. 2022-08-24 13:02:19 -04:00
replication Fix uninitialized access to InitialRunningXacts during decoding. 2022-11-25 09:38:03 +05:30
rewrite Reject non-ON-SELECT rules that are named "_RETURN". 2022-10-17 12:14:39 -04:00
snowball In the Snowball dictionary, don't try to stem excessively-long words. 2022-08-31 10:42:05 -04:00
statistics Partially undo commit 94da73281. 2022-08-05 15:57:46 -04:00
storage Ignore invalidated slots while computing oldest catalog Xmin 2022-11-22 10:56:07 +01:00
tcop Force immediate commit after CREATE DATABASE etc in extended protocol. 2022-07-26 13:07:03 -04:00
tsearch Add comments and a missing CHECK_FOR_INTERRUPTS in ts_headline. 2022-11-21 17:07:07 -05:00
utils YA attempt at taming worst-case behavior of get_actual_variable_range. 2022-11-22 14:40:44 -05:00
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
common.mk Remove PARTIAL_LINKING build mode. 2018-03-30 17:33:04 -07:00
Makefile Move basebackup code to new directory src/backend/backup 2022-08-10 14:03:09 -04:00
nls.mk Translation updates 2022-11-07 14:04:05 +01:00