Hi, This commit is breaking some Postgis tests with custom types.
Here is a minimal repro (Postgis not required) ``` -- test custom types create type t_custom_type AS ( valid bool, reason varchar, location varchar ); create or replace function f_immutable_custom_type(i integer) returns t_custom_type as $$ declare oCustom t_custom_type; begin select into oCustom true as valid, 'OK' as reason, NULL as location; return oCustom; end; $$ language plpgsql immutable; select valid, reason, location from f_immutable_custom_type(3); drop function f_immutable_custom_type; drop type t_custom_type; ``` Expected (PG12): ``` valid | reason | location -------+--------+---------- t | OK | (1 row) ``` Instead with master/HEAD (eb57bd9c1d) we are getting: ``` ERROR: could not find attribute 2 in subquery targetlist ``` Reverting 8613eda50488c27d848f8e8caa493c9d8e1b5271 fixes it, but I haven't looked into the reason behind the bug. Regards -- Raúl Marín Rodríguez carto.com