Rikard Pavelic wrote:
create function sel_test() returns test as $$ declare red record; begin select * into red from test limit 1; return red; end $$ language plpgsql;
alter table test drop column tekst; then select * from sel_test(); doesn't work anymore Even if I recreate the function. Is this a known problem?
Not known by me, certainly. It appears to be related to the definition of red as type "record". If you define it as type "test" it all seems OK. Or, you can set up a variable red2 type "test" and copy the value into that, and that works.
I do know that dropping a column just flags it as dropped, it doesn't automatically update the on-disk representation. That suggests to me there's something in the "RETURN" or "SELECT INTO" statements that's not checking for the flag and deducing the wrong type.
Trying to access a dropped column via assignment or RAISE NOTICE gives errors, which makes me think it's the RETURN statement.
Any developers care to comment? -- Richard Huxton Archonet Ltd