Re: multiple CREATE FUNCTION AS items for PLs
От | Peter Eisentraut |
---|---|
Тема | Re: multiple CREATE FUNCTION AS items for PLs |
Дата | |
Msg-id | 50DE09A0.5070707@gmx.net обсуждение исходный текст |
Ответ на | Re: multiple CREATE FUNCTION AS items for PLs (Hannu Krosing <hannu@krosing.net>) |
Список | 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.
В списке pgsql-hackers по дате отправления: