On Mar 6, 2009, at 3:49 PM, hubert depesz lubaczewski wrote:
On Fri, Mar 06, 2009 at 03:33:30PM -0500, Eric B. Ridge wrote:
So my question is really, what's the difference and why doesn't this
work with PL/PGSQL functions?
because it is long-time limitation of setof-returning plplsql
functi
On Fri, Mar 06, 2009 at 03:33:30PM -0500, Eric B. Ridge wrote:
> So my question is really, what's the difference and why doesn't this
> work with PL/PGSQL functions?
because it is long-time limitation of setof-returning plplsql functions
(i think all pl/*).
it is removed in 8.4
http://www.depesz
On Mar 6, 2009, at 3:27 PM, Raymond O'Donnell wrote:
When a function returns SETOF something, you need to treat it as if it
were a table, thus:
select * from unnest2(...);
Except that isn't true if the function is written in C.
CREATE OR REPLACE FUNCTION unnest(anyarray)
RETURNS SETOF anye
On 06/03/2009 19:53, Eric B. Ridge wrote:
> # select unnest2(ARRAY[1,2,3]), 'hi';
> ERROR: set-valued function called in context that cannot accept a set
> CONTEXT: PL/pgSQL function "unnest2" line 8 at return next
When a function returns SETOF something, you need to treat it as if it
were a tab
This is using PG v8.1.
I have a "table function" in C called "unnest". It takes "anyarray"
as its only argument and returns a set of "anyelement". It's a handy
little function for turning arrays into sets.
You can use it in two different ways:
SELECT * FROM unnest(ARRAY[1,2,3]);
o