Multiple "selects" returned from a single stored procedure

From: Shachar Shemesh <psql(at)shemesh(dot)biz>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Multiple "selects" returned from a single stored procedure
Date: 2004-05-05 19:59:44
Message-ID: 409947B0.7070609@shemesh.biz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi list,

I'm in the process of porting an existing MS-SQL database to PostgreSQL.
The application uses OLE DB (and that's why I'm writing the OLE DB for
Postgresql). One of the requirements is that we will introduce as little
changes to the application. It has to be able to work with both
databases, as well as Access (which is not really a database).

Now the question:
MS-SQL has the capacity for both out variables from stored procedures,
as well as running several "selects" inside the procedures, and then
giving the results for all selects to the caller. Fortunetly for me,
that specific application doesn't run more than one select per stored
procedure.

The way I handled out variables so far was to have the function return a
compound type, with the variables as rows. With embedded selects,
however, this will no longer work.

I guess what I would like to suggest is for the thus far unused "select"
command in PLPGSQL to be used, in some way, to return values outside the
scope of the strict "returns" context. I guess out variables will also
be nice, but that's besides the point.

If anyone has any ideas on how to both modify called parameters, and
return a rowset, please let me know. Best I came up with so far was to
create a temporary table for the out vars or the selects. I can then rig
the OLE DB to make it look as if the function returned that.

Shachar

--
Shachar Shemesh
Lingnu Open Systems Consulting
http://www.lingnu.com/

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2004-05-05 20:09:52 Re: initdb failure in CVS
Previous Message Tom Lane 2004-05-05 19:53:53 Re: initdb failure in CVS