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

From: Raymond O'Donnell <rod(at)iol(dot)ie>
To: "Eric B(dot) Ridge" <ebr(at)tcdi(dot)com>
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:27:46
Message-ID: 49B18742.5030408@iol.ie
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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 table, thus:

select * from unnest2(...);

HTH,

Ray.

------------------------------------------------------------------
Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
rod(at)iol(dot)ie
Galway Cathedral Recitals: http://www.galwaycathedral.org/recitals
------------------------------------------------------------------

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Eric B. Ridge 2009-03-06 20:33:30 Re: set-valued function called in context that cannot accept a set
Previous Message Eric B. Ridge 2009-03-06 19:53:29 set-valued function called in context that cannot accept a set