"Albert REINER" <areiner@tph.tuwien.ac.at> writes:
> is there any possibility to do recursion in plpgsql-functions?
Recursion works fine ... but an infinite recursion, such as you have
here, will quickly overflow the available stack space and cause the
backend to crash. You're invoking idPath with the same argument it
was passed, no?
I changed
> | str2 := idPath(r.id);
to
> | str2 := idPath(r.id-1);
and got
regression=# select idPath(5);idpath
---------5:4:3:2
(1 row)
which may or may not be the answer you wanted, but it does demonstrate
that a plpgsql function can recurse.
regards, tom lane