"robert treat" <xzilla(at)users(dot)sourceforge(dot)net> writes:
> Apparently the assignment of the integer value is somehow dependent on the
> name of the out parameter; when it matches the column name, you get nulls
> back. Is this a bug?
No, it's expected behavior. You're "accumulating" n copies of the
current value of the parameter variable, which is null because you've
not yet assigned anything to it.
The real issue here is that an unqualified name is matched against
plpgsql variables before considering names coming from the SQL query.
See previous pghackers discussions about changing that, and the massive
breakage of user code that would doubtless ensue :-(
regards, tom lane