Re: Multiple Resultsets - Mailing list pgsql-novice

From Joe Conway
Subject Re: Multiple Resultsets
Date
Msg-id 3F098ED6.3040101@joeconway.com
Whole thread Raw
In response to Re: Multiple Resultsets  (Bruno Wolff III <bruno@wolff.to>)
List pgsql-novice
Bruno Wolff III wrote:
> On Mon, Jul 07, 2003 at 10:04:26 -0400,
>   Michael Guerin <guerin@rentec.com> wrote:
>
>>Does anyone know if PostgreSQL can support functions that return
>>multiple results sets like SQL Server stored procedures.
>
> Yes it can. I think you want to use at least 7.3 for that feature.
> My memory is that there was something you could do in 7.2, but that
> it doesn't work nearly as well as what is available for 7.3.
>

Um, except for the *multiple* part. MS SQL Server allows a stored
procedure call like this:

   exec sp_my_stored_procedure

and that will "project" one or more results sets to the front end. Those
results cannot be qualified or joined with other data.

In Postgres 7.3 (and up) you can create a "table function" which is a
function that can be used in the FROM clause, just like a table. It can
be qualified and joined with other FROM clause sources; e.g.:

   select * from my_table_function();

However, it cannot return multiple results sets.

HTH,

joe


pgsql-novice by date:

Previous
From: Volker Krey
Date:
Subject: inheritance
Next
From: Brad Rhine
Date:
Subject: Groups and Users