Re: Using SETOF in plpgsql function - Mailing list pgsql-sql

From Tom Lane
Subject Re: Using SETOF in plpgsql function
Date
Msg-id 27932.967040675@sss.pgh.pa.us
Whole thread Raw
In response to Re: Using SETOF in plpgsql function  (Jan Wieck <janwieck@Yahoo.com>)
Responses Re: Using SETOF in plpgsql function  (Jan Wieck <janwieck@Yahoo.com>)
List pgsql-sql
Jan Wieck <janwieck@Yahoo.com> writes:
> hlefebvre wrote:
>> I'd like to return a set of integer in an pl/pgsql function. How can I
>> do that ?

>     You  can't. Not with PL/pgSQL nor with any other PL or C. The
>     problem is nested deeper and requires the  planned  querytree
>     redesign to get solved.

Not really.  Coincidentally enough, I am just in the middle of removing
execQual.c's hard-wired assumption that only SQL-language functions
can return sets.  (This is a side effect of fixing the function manager
so that SQL functions can be called in all contexts, eg used as index
functions.)  If you want to fix plpgsql so that it retains state and
can produce multiple elements of a set over repeated calls, the same
way that SQL functions do, then it could be done today.

We may well want to rip out that whole approach to set functions later
when we redo querytrees, but the real limitation so far has been bogus
assumptions in the function-call API, not querytrees.
        regards, tom lane


pgsql-sql by date:

Previous
From: hlefebvre
Date:
Subject: Re: Re: Date of creation and of change
Next
From: Tom Lane
Date:
Subject: Re: Re: Date of creation and of change