Michel Pelletier <pelletier.mic...@gmail.com> writes: > 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; > $$;
Well, you shouldn't be using PERFORM. Not only does it not do the right thing, but it's not optimized for expanded objects at all: they'll get flattened both on the way into the statement and on the way out. Try it with graph := set_element(graph, 1, 1, 1); RETURN nvals(graph); regards, tom lane