Re: set-valued function called in context that cannot accept a set

From: "Eric B(dot) Ridge" <ebr(at)tcdi(dot)com>
To: rod(at)iol(dot)ie
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: set-valued function called in context that cannot accept a set
Date: 2009-03-06 20:33:30
Message-ID: B173B9A4-DC16-4E09-B0ED-3A2C11B2C8E7@tcdi.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message hubert depesz lubaczewski 2009-03-06 20:49:23 Re: set-valued function called in context that cannot accept a set
Previous Message Raymond O'Donnell 2009-03-06 20:27:46 Re: set-valued function called in context that cannot accept a set