Re: [GENERAL] SQL advice needed

2014-03-17 Thread Torsten Förtsch
On 17/03/14 21:42, Merlin Moncure wrote: >> I can do it in plpgsql. But that would mean to accumulate the complete >> > result in memory first, right? I need to avoid that. > I would test that assumption. This is better handled in loop IMO. > > LOOP > RETURN QUERY SELECT * FROM xx(); > IF NO

Re: [GENERAL] SQL advice needed

2014-03-17 Thread Merlin Moncure
On Mon, Mar 17, 2014 at 4:20 PM, Torsten Förtsch wrote: > On 17/03/14 21:42, Merlin Moncure wrote: >>> I can do it in plpgsql. But that would mean to accumulate the complete >>> > result in memory first, right? I need to avoid that. >> I would test that assumption. This is better handled in loop

Re: [GENERAL] SQL advice needed

2014-03-17 Thread David Johnston
Torsten Förtsch wrote > Hi, > > I have a volatile function that returns multiple rows. It may also > return nothing. Now, I want to write an SQL statement that calls this > function until it returns an empty result set and returns all the rows. > > What's the best (or at least a working) way to a

Re: [GENERAL] SQL advice needed

2014-03-17 Thread Merlin Moncure
On Mon, Mar 17, 2014 at 3:21 PM, Torsten Förtsch wrote: > Hi, > > I have a volatile function that returns multiple rows. It may also > return nothing. Now, I want to write an SQL statement that calls this > function until it returns an empty result set and returns all the rows. > > So, in principl

[GENERAL] SQL advice needed

2014-03-17 Thread Torsten Förtsch
Hi, I have a volatile function that returns multiple rows. It may also return nothing. Now, I want to write an SQL statement that calls this function until it returns an empty result set and returns all the rows. So, in principle I want to: WITH RECURSIVE t AS ( SELECT * FROM xx() UNION ALL