The server still crashes when only an inner type is altered:
CREATE TYPE inner_t AS (x INT, y INT); CREATE TYPE outer_t AS (a INT, b inner_t);
CREATE OR REPLACE FUNCTION test_nested() RETURNS record LANGUAGE plpgsql AS $$ DECLARE r1 outer_t; r2 outer_t; BEGIN r1 := ROW(1, ROW(10, power(2,30)::int4)::inner_t)::outer_t; ALTER TYPE inner_t ALTER ATTRIBUTE y TYPE TEXT; r2 := r1; RETURN r2; END; $$;
SELECT test_nested(); -- server crash
Thank you for the nested composite testcase and the fix in cursor code, the changes look good.. I fixed the PL/pgsql to fix the nested components.