On 5/3/18 13:03, Andrew Gierth wrote:
>>>>>> "Peter" == Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes:
>
> Peter> The attached test fixes this issue by flattening the toast
> Peter> values before storing them into PL/pgSQL variables. It could use
> Peter> another check to see if there are other code paths that need
> Peter> similar adjustments, but I think it's the right idea in general.
>
> Uhh.
>
> What about:
> or or or ...
Here is a more complete patch. I made a call graph to get to the
bottom, literally, of how variable assignments happen in PL/pgSQL. (See
attached.) There are four leaf functions to patch up.
Also, I wrote some isolation tests to hit each of these cases. I wasn't
able to construct one for expanded_record_set_fields(), but the
principle there should be the same.
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services