I think we need to deny changing column types if a function is using the
table type as a return set.
test=# create table test (a int4);
CREATE TABLE
test=# create function test () returns setof test as 'select 1' language
sql;
CREATE FUNCTION
test=# alter table test alter a type bigint;
ALTER TABLE
test=# select * from test();
ERROR: return type mismatch in function declared to return test
DETAIL: Final SELECT returns integer instead of bigint at column 1.
CONTEXT: SQL function "test" during startup
Chris