On Tue, Nov 6, 2018 at 2:54 PM David Gauthier <davegauthie...@gmail.com> wrote:
> Hi: > > I'm trying/failing to write a recursive plpgsql function where the > function tries to operate on a hierary of records in a reflexive table. > parent-child-grandchild type of recursion. > > I tried with a cursor, but got a "cursor already in use" error. So that > looks like scoping. > > I know I did this sort of thing in the past, but I can't remember if I > used cursors or some other construct to traverse the hierarchy. > Recursive common-table-expression queries would be the typical way. Perhaps that's what you used before https://www.postgresql.org/docs/current/queries-with.html Cheers, Steve