Here's two backtraces from gdb from this function:
CREATE OR REPLACE FUNCTION test2(graph matrix) RETURNS bigint LANGUAGE plpgsql AS $$ BEGIN perform set_element(graph, 1, 1, 1); RETURN nvals(graph); end; $$;
Both traces are in that file split on the hyphens line 44. I'm still puzzling it out, could it have something to do with the volatility of the functions? I'm not entirely clear on how to interpret function volatility with expanded objects, nvals is STRICT, but set_element is STABLE. I think my logic there was because it's a mutation. This is likely another misunderstanding of mine.
Michel Pelletier <pelletier.michel@gmail.com> writes: > On Wed, Oct 23, 2024 at 8:21 AM Tom Lane <tgl@sss.pgh.pa.us> wrote: >> Another thing that confuses me is why there's a second flatten_matrix >> operation happening here. Shouldn't set_element return its result >> as a R/W expanded object?
Hmph. That seems right. Can you add errbacktrace() to your logging ereports, in hopes of seeing how we're getting to flatten_matrix? Or break there with gdb for a more complete/reliable stack trace.