On Tue, 14 Jun 2011, Tom Lane wrote:
Rick Harding rhard...@mitechie.com writes:
CREATE OR REPLACE FUNCTION mysum(curr integer, vals group_data)
RETURNS integer
AS $$
try:
curr = curr + vals['weight']
except UnboundLocalError:
plpy.notice(UNBOUND)
I'm trying to test out a user defined aggregation function. The problem I'm
getting is that the state is never passed to the function after the first
call. I'm wondering if this is an issue with having my function defined as
a pypython function or something.
Each call I get an UnboundLocalError
Rick Harding rhard...@mitechie.com writes:
CREATE OR REPLACE FUNCTION mysum(curr integer, vals group_data)
RETURNS integer
AS $$
try:
curr = curr + vals['weight']
except UnboundLocalError:
plpy.notice(UNBOUND)
curr = 0
return curr
$$ LANGUAGE