Re: Using a RETURN NEXT

From: Joe Conway <mail(at)joeconway(dot)com>
To: "Mr Weinbach, Larry" <larryweinbach(at)yahoo(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Using a RETURN NEXT
Date: 2003-06-08 22:33:48
Message-ID: 3EE3B9CC.8060600@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Mr Weinbach, Larry wrote:
> But at execution time I am getting thi error :
>
> WARNING: Error occurred while executing PL/pgSQL
> function word_case
> WARNING: line 5 at return next
> ERROR: Set-valued function called in context that
> cannot accept a set
>

You didn't show the execution time SQL statement, but the error you are
getting usually indicates you did something like:

SELECT word_case();

but you should have done:

(define the function to return setof record)
SELECT * FROM word_case() AS (message text);

or

CREATE TYPE word_case_type AS (message text);
(define the function to return setof word_case_type)
SELECT * FROM word_case();

HTH,

Joe

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2003-06-09 01:05:55 Re: "Join" on delimeter aggregate query
Previous Message Jan Wieck 2003-06-08 15:08:25 Re: (long) What's the problem?