Re: set-valued function called in context that cannot accept a set - Mailing list pgsql-general

From Eric B. Ridge
Subject Re: set-valued function called in context that cannot accept a set
Date
Msg-id B173B9A4-DC16-4E09-B0ED-3A2C11B2C8E7@tcdi.com
Whole thread Raw
In response to Re: set-valued function called in context that cannot accept a set  (Raymond O'Donnell <rod@iol.ie>)
Responses Re: set-valued function called in context that cannot accept a set  (hubert depesz lubaczewski <depesz@depesz.com>)
List pgsql-general
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 anyelement AS 'unnest'
LANGUAGE 'C' IMMUTABLE;

    SELECT unnest(...);

works just fine using the above defined C function.

So my question is really, what's the difference and why doesn't this
work with PL/PGSQL functions?

eric

pgsql-general by date:

Previous
From: Raymond O'Donnell
Date:
Subject: Re: set-valued function called in context that cannot accept a set
Next
From: hubert depesz lubaczewski
Date:
Subject: Re: set-valued function called in context that cannot accept a set