Re: lazy detoasting - Mailing list pgsql-hackers

From Tom Lane
Subject Re: lazy detoasting
Date
Msg-id 18399.1523469317@sss.pgh.pa.us
Whole thread Raw
In response to Re: lazy detoasting  (Chapman Flack <chap@anastigmatix.net>)
Responses Re: lazy detoasting  (Chapman Flack <chap@anastigmatix.net>)
List pgsql-hackers
Chapman Flack <chap@anastigmatix.net> writes:
> On 04/11/2018 11:33 AM, Tom Lane wrote:
>> OK, but if this object only lives within a single function call,
>> what's the problem?  The underlying row must be visible to the
>> calling query, and that condition won't change for the duration
>> of the call.

> Well, the devilsAdvocate() function would stash the object
> in a static, then try to look at it some time in a later call
> in the same transaction.

If you're worried about that, you should also worry about what happens
if the function uses the static variable in some later transaction.
The spec grants you license to throw an error, but it still needs to
be a clean error (not something about "can't find toast value", IMO).

Can you detect that the value is being stored in a long-lived variable
and detoast at that point?

            regards, tom lane


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: 'make check' fails
Next
From: Tom Lane
Date:
Subject: Re: WARNING in parallel index creation.