Re: recursive call to function returning SETOF

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: Max Nachlinger <nachlinger(at)hotmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: recursive call to function returning SETOF
Date: 2003-09-15 18:20:54
Message-ID: 20030915111955.K69836@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Mon, 15 Sep 2003, Max Nachlinger wrote:

> Hello all,
>
> Im attempting to write a function in plpgsql (for PostgreSQL 7.3.4) to
> power a threaded discussion forum, and am having difficulties calling the
> function in question recursively. The function returns a SETOF (see the
> function definition below) a custom type I created to hold a row of data.
> Id be grateful if anyone could share their experiences calling functions
> returning a SETOF recursively.

I think you'd need to call it like
FOR record IN SELECT * from get_posts(post.post_id) LOOP
RETURN NEXT record;
END LOOP;

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Wim 2003-09-15 18:24:57 Re: Vacuum runs in a loop?
Previous Message Tom Lane 2003-09-15 17:47:14 Re: Vacuum runs in a loop?