From: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
---|---|
To: | Hannu Krosing <hannu(at)krosing(dot)net> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: multiple CREATE FUNCTION AS items for PLs |
Date: | 2012-12-28 21:05:36 |
Message-ID: | 50DE09A0.5070707@gmx.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
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.
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 2012-12-28 21:19:57 | Re: proposal: ANSI SQL 2011 syntax for named parameters |
Previous Message | Peter Geoghegan | 2012-12-28 20:59:26 | Re: enhanced error fields |