Re: Using SETOF in plpgsql function

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jan Wieck <janwieck(at)Yahoo(dot)com>
Cc: hlefebvre <hlefebvre(at)lexbase(dot)net>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Using SETOF in plpgsql function
Date: 2000-08-23 14:24:35
Message-ID: 27932.967040675@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Jan Wieck <janwieck(at)Yahoo(dot)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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Jan Wieck 2000-08-23 14:27:02 Re: Using SETOF in plpgsql function
Previous Message Tom Lane 2000-08-23 14:00:59 Re: Null function parameters