Re: Problem using set-returning functions

From: John DeSoi <desoi(at)pgedit(dot)com>
To: Markus Schaber <schabi(at)logix-tt(dot)com>
Cc: PostGIS Users Discussion <postgis-users(at)postgis(dot)refractions(dot)net>, PostgreSQL SQL List <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Problem using set-returning functions
Date: 2006-03-27 13:32:39
Message-ID: 7DB6EE64-AB49-4DA6-B690-21A53FD6045E@pgedit.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Markus Schaber 2006-03-27 13:32:51 Re: functions in WHERE clause
Previous Message Markus Schaber 2006-03-27 13:21:05 Re: [postgis-users] Problem using set-returning functions