On 12/28/12 7:09 AM, Hannu Krosing wrote:
> Maybe just export the function with the same name as is defined in
> CREATE FUNCTION ?
> 
> And in case we do want to override it, call it
> 
> CREATE FUNCTION foo(a int,b int, c text) AS $$
> # plpython: module modulename
> import x,y,z
> 
> def foo(a,b,c):
>     return a + b + c
> 
> def foo2(a,b,c):
>     return foo(a,b,int(c))
> 
> __call__ = foo2
> 
> $$ language plpythonu

I like this approach, except I would call the attribute something like
__plpy_something___.

> If we always require the export using __call__ in new-style pl/python
> functions we could
> leave out the "# plpython: module " part altogether and just test for
> __call__ in the compiled
> modules namespace after trying to compile the source code as module and
> re-compile
> using current methods if this fails.

That's a thought.  I'm not yet sure whether I prefer it.


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

Reply via email to