Re: Function problem after alter table

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Function problem after alter table
Дата
Msg-id 652.1204580433@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Function problem after alter table  (Sean Dooley <srd1@st-andrews.ac.uk>)
Ответы SQL Question  (Joshua <joshua@joshuaneil.com>)
Список pgsql-novice
Sean Dooley <srd1@st-andrews.ac.uk> writes:
>     FOR RESULTSET IN
>         SELECT * FROM item_date WHERE item_id = in_item_id
>     LOOP
>         RETURN NEXT resultset;
>     END LOOP;

> This works fine, returns all the matching data from item_date
> However, if I alter the table item_date, for example
> ALTER TABLE item_date ADD COLUMN foo text;
> When I run the function now, I get the error
> ERROR:  wrong record type supplied in RETURN NEXT

This example works for me in PG 8.3.  In prior releases I think you'd
need to use FOR ... IN EXECUTE to force the SELECT to get re-planned
each time through.

            regards, tom lane

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

Предыдущее
От: Sean Dooley
Дата:
Сообщение: Function problem after alter table
Следующее
От: Joshua
Дата:
Сообщение: SQL Question