Re: Problem using set-returning functions - Mailing list pgsql-sql

From John DeSoi
Subject Re: Problem using set-returning functions
Date
Msg-id 7DB6EE64-AB49-4DA6-B690-21A53FD6045E@pgedit.com
Whole thread Raw
In response to Problem using set-returning functions  (Markus Schaber <schabi@logix-tt.com>)
Responses Re: Problem using set-returning functions
List pgsql-sql
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 the same
> context:


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 for your query I think you need something like:

select foo, (select x from generate_x(bar)) from test;



John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL



pgsql-sql by date:

Previous
From: Markus Schaber
Date:
Subject: Re: functions in WHERE clause
Next
From: "Jim C. Nasby"
Date:
Subject: Re: Expressing a result set as an array (and vice versa)?