Re: trouble building user defined agg function with plpython

Поиск
Список
Период
Сортировка
От Rick Harding
Тема Re: trouble building user defined agg function with plpython
Дата
Msg-id 20110616132949.GA8186@toraken.morpace-i.com
обсуждение исходный текст
Ответ на Re: trouble building user defined agg function with plpython  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
On Tue, 14 Jun 2011, Tom Lane wrote:

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

В списке pgsql-general по дате отправления:

Предыдущее
От: Torsten Zühlsdorff
Дата:
Сообщение: Re: You could be a PostgreSQL Patch Reviewer!
Следующее
От: "Igor Neyman"
Дата:
Сообщение: Re: Constraint to ensure value does NOT exist in another table?