Re: trouble building user defined agg function with plpython

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Rick Harding <rharding(at)mitechie(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: trouble building user defined agg function with plpython
Date: 2011-06-14 22:30:10
Message-ID: 9914.1308090610@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Stefan Keller 2011-06-14 22:31:12 Re: No implicit index created when adding primary key with ALTER TABLE
Previous Message mike stanton 2011-06-14 20:57:13 Re: system command in dblink?