Re: [SQL] Problem using set-returning functions

2006-03-27 Thread Tom Lane
Markus Schaber <[EMAIL PROTECTED]> writes: > navteq=# select foo,generate_x(bar) from test; > ERROR: set-valued function called in context that cannot accept a set > CONTEXT: PL/pgSQL function "generate_x" line 5 at return next plpgsql SRFs don't support being called from the SELECT target list,

Re: [SQL] Problem using set-returning functions

2006-03-27 Thread Markus Schaber
Hi, Stephan, Stephan Szabo wrote: > It's an implementation detail. Some languages handle SRFs in a way that > can be handled in the select list (SQL and C I think) and others do not > (plpgsql). Ah, that's an enlightening explanation, thanks. > The latter will likely change at some point, altho

Re: [SQL] Problem using set-returning functions

2006-03-27 Thread Stephan Szabo
On Mon, 27 Mar 2006, Markus Schaber wrote: > Hi, John, > > John DeSoi wrote: > > > With SRFs, you need to specify what you want to select. In other words > > if you are calling generate_x(bar) you need "select * from > > generate_x(bar)" -- "select generate_x(bar)" will not work. > > So, then, wh

Re: [SQL] Problem using set-returning functions

2006-03-27 Thread John DeSoi
Hi Markus, On Mar 27, 2006, at 9:00 AM, Markus Schaber wrote: So, then, why does it work with generate_series() and dump()? I'm not sure. All I know is I spent a while the other day puzzling over the same error message you had and finally realized I had to add a select expression to fix i

Re: [SQL] Problem using set-returning functions

2006-03-27 Thread Markus Schaber
Hi, John, John DeSoi wrote: > With SRFs, you need to specify what you want to select. In other words > if you are calling generate_x(bar) you need "select * from > generate_x(bar)" -- "select generate_x(bar)" will not work. So, then, why does it work with generate_series() and dump()? Confuse

Re: [SQL] Problem using set-returning functions

2006-03-27 Thread John DeSoi
On Mar 27, 2006, at 5:41 AM, Markus Schaber wrote: navteq=# select foo,generate_x(bar) from test; ERROR: set-valued function called in context that cannot accept a set CONTEXT: PL/pgSQL function "generate_x" line 5 at return next However, it is fine to call other set returning functions in t