How to 'register' functions, so they can be called (plpythonu)

From: "blay bloo" <blaybloo(at)googlemail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: How to 'register' functions, so they can be called (plpythonu)
Date: 2007-09-04 18:53:16
Message-ID: 66c468170709041153n55c1f215o5483448e201859b3@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I am defining some functions using plpythonu, through the standard means.

Here I have one function (test1) which calls another (testfunc). When
I excute this I get the following error:

ERROR: plpython: function "test1" failed
DETAIL: <type 'exceptions.NameError'>: global name 'testfunc' is not defined

However, from the console, select testfunc('test') works fine.

I was wondering how do I 'register'/'reference' these functions so
that one function can call another? I am guessing this is important,
i.e. how will I access the complete functionality of the general
python libs?

Cheers, Blay.

PS functions are defined in the usual way - e.g.

create or replace function test1(text) returns integer as $$
return 1
$$ language plpythonu;

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ned Lilly 2007-09-04 18:54:35 Re: Reporting services for PostgreSQL
Previous Message Madison Kelly 2007-09-04 18:47:11 SELECT question (splitting a field)