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

From: Richard Huxton <dev(at)archonet(dot)com>
To: blay bloo <blaybloo(at)googlemail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How to 'register' functions, so they can be called (plpythonu)
Date: 2007-09-05 08:35:35
Message-ID: 46DE6A57.9020307@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

blay bloo wrote:
> 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

You need to call it as an SQL statement "SELECT testfunc(...)"

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

I believe the python embedder mangles the function names when it loads
them into PG, so you can't call them directly.

--
Richard Huxton
Archonet Ltd

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2007-09-05 08:39:16 Re: psql hanging
Previous Message Andrus 2007-09-05 08:33:19 Re: Reporting services for PostgreSQL