Search Postgresql Archives

Re: trouble building user defined agg function with plpython

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Rick Harding <rharding@xxxxxxxxxxxx> 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

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux