Re: problems selecting from altered table

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: problems selecting from altered table
Дата
Msg-id 4677F522.8010105@archonet.com
обсуждение исходный текст
Ответ на problems selecting from altered table  (Rikard Pavelic <rikard.pavelic@zg.htnet.hr>)
Ответы Re: problems selecting from altered table  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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

В списке pgsql-general по дате отправления:

Предыдущее
От: Gerhard Hintermayer
Дата:
Сообщение: Re: Apparent Wraparound?
Следующее
От: "Merlin Moncure"
Дата:
Сообщение: Re: Subquery problems