I wrote:
> Works for me in 8.4.11 (after correcting record_var.id -> record_var.pid
> at line 6). Maybe you need to update to some more recent version than
> 8.4.0.
Actually, I do get the described behavior when trying this in 8.3,
which does not have FOR-over-cursor. So maybe the more appropriate
question is whether you're really running 8.4.anything.
regards, tom lane