Hi,
i compiled and installed this.
I wonder how you would write a recursive function such as:
CREATE FUNCTION factx(int4) RETURNS int4 AS '
def f(n): if n==0: return 1 else: return n*f(n-1)
return f(args[0])
' LANGUAGE 'plpython';
When called, it crashes in the return n*f(n-1)
line, not knowing what f is. I could fix that using SD like this:
CREATE FUNCTION factx(int4) RETURNS int4 AS '
def f(n): if n==0: return 1 else: return n*SD["f"](n-1)
SD["f"]=f
return f(args[0])
' LANGUAGE 'plpython';
Or putting the function as attribute of pgpy.
What happens to the namespace?
Erny
Spain