Chapman Flack <chap(at)anastigmatix(dot)net> writes:
> If I copy an out-of-line, on-disk TOAST pointer into a memory context
> with transaction lifetime, with an eye to detoasting it later in the
> same transaction, are there circumstances where it wouldn't work?
Should be safe *as long as you hold onto a snapshot that can see the
toast value's parent row*. Otherwise, it's not.
For a counterexample, see the changes we had to make to avoid depending
on out-of-line toast values in the catcaches, commit 08e261cbc.
regards, tom lane