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