Search Postgresql Archives

Re: problems selecting from altered table

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux