From: | Steve Crawford <scrawford(at)pinpointresearch(dot)com> |
---|---|
To: | davegauthierpg(at)gmail(dot)com |
Cc: | PG-General Mailing List <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: recursion in plpgsql |
Date: | 2018-11-06 23:31:24 |
Message-ID: | CAEfWYyzaS1nXsJTS3yr1UsMZYxBucGhL1Lc+2NyuV-KJHmGbqQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Tue, Nov 6, 2018 at 2:54 PM David Gauthier <davegauthierpg(at)gmail(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2018-11-07 00:29:56 | Re: recursion in plpgsql |
Previous Message | David Gauthier | 2018-11-06 22:54:02 | recursion in plpgsql |