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

From Tom Lane
Subject Re: Problem using set-returning functions
Date
Msg-id 14736.1143474510@sss.pgh.pa.us
Whole thread Raw
In response to Problem using set-returning functions  (Markus Schaber <schabi@logix-tt.com>)
List pgsql-sql
Markus Schaber <schabi@logix-tt.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


pgsql-sql by date:

Previous
From: Markus Schaber
Date:
Subject: Re: Problem using set-returning functions
Next
From: Bryce Nesbitt
Date:
Subject: Bitfields always atomic? Other way to store attributes?