Re: [GENERAL] trouble building user defined agg function with plpython

2011-06-16 Thread Rick Harding
On Tue, 14 Jun 2011, Tom Lane wrote: > Rick Harding writes: > > CREATE OR REPLACE FUNCTION mysum(curr integer, vals group_data) > > RETURNS integer > > AS $$ > > try: > > curr = curr + vals['weight'] > > except UnboundLocalError: > > plpy.notice("UNBOUND") > > cu

Re: [GENERAL] trouble building user defined agg function with plpython

2011-06-14 Thread Tom Lane
Rick Harding 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 plpythonu; This

[GENERAL] trouble building user defined agg function with plpython

2011-06-14 Thread Rick Harding
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 e