pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ian Harding <iharding@pakrat.com>
To: pgsql-sql@postgresql.org
Subject: Re: pl/pgsql Limits
Date: Fri, 19 Jan 2001 21:04:12 -0800
Message-ID: <3A691C4C.BA1C60EC@pakrat.com> (raw)
References: <2300.979407081@sss.pgh.pa.us>

Tom Lane wrote:

> Jan Wieck <janwieck@Yahoo.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

OK, here's my brute force stupid hack to work around it.  I create a temporary
table, call my procedure, which inserts records into my temporary table, then
I select from it.  The table had to exist when I created the procedure, but
that's OK, I just delete it afterwards.

When I disconnect with psql, the temp table goes away.  Of course I could just
drop it, but I am curious... With AOLServer, which uses connection pooling,
might my connection stay open all day and other transactions have visibility
of my temporary table?  I don't quite get that part.

Ian




view thread (6+ messages)  latest in thread

Message-ID: <3A691C4C.BA1C60EC@pakrat.com>
Permalink:  ../3A691C4C.BA1C60EC@pakrat.com/
Also on:    postgresql.org/message-id/3A691C4C.BA1C60EC@pakrat.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: iharding@pakrat.com
  Subject: Re: pl/pgsql Limits
  In-Reply-To: <3A691C4C.BA1C60EC@pakrat.com>
  References: <2300.979407081@sss.pgh.pa.us> <3A691C4C.BA1C60EC@pakrat.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox