Re: Problem using set-returning functions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
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 15:48:30
Message-ID: 14736.1143474510@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Markus Schaber <schabi(at)logix-tt(dot)com> 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,
only from a FROM-expression. Your other function is probably written
in SQL not plpgsql; SQL functions do support this.

plpgsql could probably be fixed if we were really motivated to do so,
but I think most people who have looked at it feel we should phase out
the capability to call SRFs from a target list, rather than extend it.
It's weird and not very semantically sound --- in particular, there's no
very sensible definition if there's more than one of them in the target
list. See past discussions in the PG archives.

regards, tom lane

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Bryce Nesbitt 2006-03-27 19:09:31 psqlODBC driver -- too many tables shown
Previous Message Markus Schaber 2006-03-27 15:14:50 Re: Problem using set-returning functions