1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-06 13:46:51 +03:00

Cache by-reference missing values in a long lived context

Attribute missing values might be needed past the lifetime of the tuple
descriptors from which they are extracted. To avoid possibly using
pointers for by-reference values which might thus be left dangling, we
cache a datumCopy'd version of the datum in the TopMemoryContext. Since
we first search for the value this only needs to be done once per
session for any such value.

Original complaint from Tom Lane, idea for mitigation by Andrew Dunstan,
tweaked by Tom Lane.

Backpatch to version 11 where missing values were introduced.

Discussion: https://postgr.es/m/1306569.1687978174@sss.pgh.pa.us
This commit is contained in:
Andrew Dunstan
2023-08-22 11:57:08 -04:00
parent 5a32af3f2c
commit 7f4515a58e
2 changed files with 90 additions and 1 deletions

View File

@@ -3275,6 +3275,7 @@ mbstr_verifier
memoize_hash
memoize_iterator
metastring
missing_cache_key
mix_data_t
mixedStruct
mode_t