postgresql/src
Tom Lane 0313c5dc62 Make SQLFunctionCache long-lived again.
At this point, the only data structures we allocate directly in
fcontext are the SQLFunctionCache struct itself, the ParamListInfo
struct, and the execution_state array, all of which are small and
perfectly capable of being re-used across executions of the same
FmgrInfo.  Hence, let's give them the same lifespan as the FmgrInfo.
This step gets rid of the separate SQLFunctionLink struct and makes
fn_extra point to SQLFunctionCache again.  We also get rid of the
separate fcontext memory context and allocate these items directly
in fn_mcxt.

For notational simplicity, SQLFunctionCache still has an fcontext
field, but it's just a copy of fn_mcxt.

The motivation for this is to allow these structures to live as
long as the FmgrInfo and be re-used across calls, restoring the
original design without its propensity for memory leaks.  This
gets rid of some per-call overhead that we added in 0dca5d68d.

We also make an effort to re-use the JunkFilter and result slot.
Those might need to change if the function definition changes,
so we compromise by rebuilding them if the cached plan changes.

This also moves the tuplestore into fn_mcxt so that it can be
re-used across calls, again undoing a change made in 0dca5d68d.
2025-04-17 12:56:31 -04:00
..
backend Make SQLFunctionCache long-lived again. 2025-04-17 12:56:31 -04:00
bin pg_dump: Set private_date pointer to NULL in callback 2025-04-17 12:58:00 +02:00
common Harmonize function parameter names for Postgres 18. 2025-04-12 12:07:36 -04:00
fe_utils pg_restore cleanups 2025-04-16 12:04:34 -04:00
include Assert lack of hazardous buffer locks before possible catalog read. 2025-04-17 05:00:30 -07:00
interfaces Fixup various new-to-v18 usages of appendPQExpBuffer 2025-04-17 11:37:55 +12:00
makefiles Add support for basic NUMA awareness 2025-04-07 23:08:17 +02:00
pl plpython: Add test for returning Python set from SETOF function 2025-04-03 11:09:50 +02:00
port Cleanup of pg_numa.c 2025-04-09 21:50:17 +02:00
template thread-safety: gmtime_r(), localtime_r() 2024-08-23 07:43:04 +02:00
test Assert lack of hazardous buffer locks before possible catalog read. 2025-04-17 05:00:30 -07:00
timezone pg_noreturn to replace pg_attribute_noreturn() 2025-03-13 12:37:26 +01:00
tools pg_restore cleanups 2025-04-16 12:04:34 -04:00
tutorial Doc: simplify the tutorial's window-function examples. 2025-01-21 14:43:21 -05:00
.gitignore
DEVELOPERS
Makefile Remove distprep 2023-11-06 15:18:04 +01:00
Makefile.global.in Add support for basic NUMA awareness 2025-04-07 23:08:17 +02:00
Makefile.shlib Remove AIX support 2024-02-28 15:17:23 +04:00
meson.build Update copyright for 2025 2025-01-01 11:21:55 -05:00
nls-global.mk Remove distprep 2023-11-06 15:18:04 +01:00