From: | Rick Harding <rharding(at)mitechie(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: trouble building user defined agg function with plpython |
Date: | 2011-06-16 13:29:49 |
Message-ID: | 20110616132949.GA8186@toraken.morpace-i.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Tue, 14 Jun 2011, Tom Lane wrote:
> Rick Harding <rharding(at)mitechie(dot)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 plpythonu;
>
> This function doesn't work when called manually; it's got nothing to do
> with the aggregate context. You should read the last half of this page:
>
> http://www.postgresql.org/docs/9.0/static/plpython-funcs.html
>
> regards, tom lane
Thanks so much, I had missed that part in the docs about reassigning the
function parameters. That helped point me in the right direction.
Rick
From | Date | Subject | |
---|---|---|---|
Next Message | Scott Ribe | 2011-06-16 13:34:48 | Re: No implicit index created when adding primary key with ALTER TABLE |
Previous Message | Igor Neyman | 2011-06-16 13:21:20 | Re: Constraint to ensure value does NOT exist in another table? |