From: | Richard Huxton <dev(at)archonet(dot)com> |
---|---|
To: | Rikard Pavelic <rikard(dot)pavelic(at)zg(dot)htnet(dot)hr> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: problems selecting from altered table |
Date: | 2007-06-19 15:24:18 |
Message-ID: | 4677F522.8010105@archonet.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Merlin Moncure | 2007-06-19 15:24:29 | Re: Subquery problems |
Previous Message | Chris Browne | 2007-06-19 15:22:17 | Re: [PERFORM] Postgres VS Oracle |