Re: BUG #4585: out parameter name cuases disruption in custom aggregate? - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #4585: out parameter name cuases disruption in custom aggregate?
Date
Msg-id 16570.1229466122@sss.pgh.pa.us
Whole thread Raw
In response to BUG #4585: out parameter name cuases disruption in custom aggregate?  ("robert treat" <xzilla@users.sourceforge.net>)
List pgsql-bugs
"robert treat" <xzilla@users.sourceforge.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

pgsql-bugs by date:

Previous
From: Robert Treat
Date:
Subject: Re: BUG #4585: out parameter name cuases disruption in custom aggregate?
Next
From: Tom Lane
Date:
Subject: Re: BUG #4582: Renaming sequences and default value