Re: Recursive PLPGSQL function?

From: "Mark Cave-Ayland" <m(dot)cave-ayland(at)webbased(dot)co(dot)uk>
To: "'DeJuan Jackson'" <djackson(at)speedfc(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Recursive PLPGSQL function?
Date: 2004-08-05 07:20:28
Message-ID: 8F4A22E017460A458DB7BBAB65CA6AE5026628@openmanage
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


> -----Original Message-----
> From: DeJuan Jackson [mailto:djackson(at)speedfc(dot)com]
> Sent: 04 August 2004 17:56
> To: Mark Cave-Ayland
> Cc: pgsql-general(at)postgresql(dot)org
> Subject: Re: [GENERAL] Recursive PLPGSQL function?
>
>
> If I'm not mistaken you have an infinit recursion because you
> are always
> pulling the same id (whatever _id starts at) throughout each
> function call.
>
> Postgres is most likely killing the functions when it's hits
> some stack
> or memory limit.

Ahhh yes I got it now :) I was pulling in the wrong field from the inner
nested record set which was causing it to call itself as you suggested.
I did suspect this and put a RAISE NOTICE at the beginning of the
function to try and debug it, but the message was only displayed perhaps
once every several hundred lines of output between many "CONTEXT:
PL/pgSQL function "findsubcategories" line 15 at for over" messages,
which made me think that something was being overwritten in the
recursion (for an infinite recursion I would have expected the screen to
fill with hundreds of RAISE NOTICE message until something died).

Anyway, it all seems to be working now - thanks very much for the help.

Mark.

---

Mark Cave-Ayland
Webbased Ltd.
Tamar Science Park
Derriford
Plymouth
PL6 8BX
England

Tel: +44 (0)1752 764445
Fax: +44 (0)1752 764446

This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender. You
should not copy it or use it for any purpose nor disclose or distribute
its contents to any other person.

Browse pgsql-general by date

  From Date Subject
Next Message David Garamond 2004-08-05 09:04:20 case insensitive sorting & searching in oracle 10g
Previous Message Uwe C. Schroeder 2004-08-05 07:05:30 Re: Creating an hourly backup