Re: pl/pgsql Limits

From: Ian Harding <iharding(at)pakrat(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: pl/pgsql Limits
Date: 2001-01-20 04:31:09
Message-ID: 3A69148D.F0DFF8D@pakrat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Tom Lane wrote:

> Jan Wieck <janwieck(at)Yahoo(dot)com> writes:
> >> As it is known that any funtion, written in pl/pgsql, can only
> >> retrun one tuple. I am just wondering it were true as well for function
> >> written in C language. I need to write few function that will retrun
> >> mulitiple rows satsifying a certain set of conditions.
>
> > We plan to tackle the problem for v7.2.
>
> It is possible for a C function to return a set (ie, multiple values
> returned over successive calls) as of 7.1; it's even documented, see
> src/backend/utils/fmgr/README. And you can return a tuple if you know
> how (this part is not documented, but you can crib it from the
> SQL-function support in backend/executor/functions.c).
>
> The real problem is that the rest of the system doesn't let you *do*
> anything very useful with either set-valued or tuple-valued functions.
> This is what we need to address in future releases. Ideally I think
> a function returning sets and/or tuples should be treated as a table
> source, so that you'd write ... FROM function(args) AS alias, ...
>
> regards, tom lane

How do you work around this? All I can think of is to call a the function and
have it create a temporary table, then select from that table in the same
transaction (to use the same connection). Does a temporary table created by a
function continue to exist after the function finishes? I have a stored
procedure in SQL Server that I have to create a temporary table then select
from the table inside the same procedure. I'm not sure it would work after
the SP is done...

Ian

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Forest Wilkinson 2001-01-20 04:54:21 unreferenced primary keys: garbage collection
Previous Message Robert B. Easter 2001-01-20 03:14:38 Re: Trouble with subqueries