]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Cache by-reference missing values in a long lived context
authorAndrew Dunstan <andrew@dunslane.net>
Tue, 22 Aug 2023 15:57:08 +0000 (11:57 -0400)
committerAndrew Dunstan <andrew@dunslane.net>
Wed, 23 Aug 2023 21:22:16 +0000 (17:22 -0400)
commit2d13dab048a7e0777875529620f81d32ce57dfd8
tree53eb3d6dee6cd88f8f251c9468209b2ed97f2d4e
parentc176d97895be92ceb1454a3b7e14bffe7b7da364
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
src/backend/access/common/heaptuple.c
src/tools/pgindent/typedefs.list