Re: Do Stored Procedures exist (Besides FUNCTIONs)

Lists: pgsql-novice
From: "Art Nicewick" <art(dot)nicewick(at)ams(dot)com>
To: "Josh Berkus" <josh(at)agliodbs(dot)com>
Cc: Masse Jacques <jacques(dot)masse(at)bordeaux(dot)cemagref(dot)fr>, pgsql-novice(at)postgresql(dot)org
Subject: Re: Do Stored Procedures exist (Besides FUNCTIONs)
Date: 2002-03-04 20:44:58
Message-ID: OF764608DE.DAAFB99A-ON85256B72.0071C056@ams.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice


I guess I should have made this two questions . . . . I got your answers
(On the TODO list). I was wondering if that was true for both issues:

1. ability to call a function (Like a store procedure call) ?

2. Ability to return multiple values ?

Are both of these on the TODO list ?.


"Josh Berkus"
<josh(at)agliodb To: "Art Nicewick" <art(dot)nicewick(at)ams(dot)com>, Masse Jacques
s.com> <jacques(dot)masse(at)bordeaux(dot)cemagref(dot)fr>
cc: pgsql-novice(at)postgresql(dot)org
03/04/02 Subject: Re: [NOVICE] Do Stored Procedures exist (Besides
03:11 PM FUNCTIONs)

Art,

> It seems the all the discussions in the ORACLE TO PGSQL port document
> are
> all about converting FUNCTIONs to FUNCTIONs, Procedures to FUNCTIONs.
> What
> about application that already return multiple parameters from a
> stored
> procedure.

This is an area currently under development for PostgreSQL. There is
some limited ability to return recordsets from Postgres using cursor
and/or Record objects. However, I do not know that this is yet
documented, as the functionality was just added for 7.2.

Overall, stored procedures like you describe remain on the "To Do"
list.

-Josh Brkus


From: "Josh Berkus" <josh(at)agliodbs(dot)com>
To: "Art Nicewick" <art(dot)nicewick(at)ams(dot)com>, "Josh Berkus" <josh(at)agliodbs(dot)com>
Cc: Masse Jacques <jacques(dot)masse(at)bordeaux(dot)cemagref(dot)fr>, pgsql-novice(at)postgresql(dot)org
Subject: Re: Do Stored Procedures exist (Besides FUNCTIONs)
Date: 2002-03-04 21:04:20
Message-ID: web-816456@davinci.ethosmedia.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice

Art,

> 1. ability to call a function (Like a store procedure call) ?

SELECT function_name(params);

> 2. Ability to return multiple values ?
>
> Are both of these on the TODO list ?.

Just #2. And, as I said, there is some limited ability to return
mutliple values now. I just don't know how to use it. Hopefully
another developer will speak up.

If, however, you're looking to post Oracle stored procedures unaltered,
with multiple output params or returning recordsets straight to the
buffer, don't expect it until Postgres 7.5 at the earliest.

-Josh Berkus


From: "Joshua b(dot) Jore" <josh(at)greentechnologist(dot)org>
To: Josh Berkus <josh(at)agliodbs(dot)com>
Cc: Art Nicewick <art(dot)nicewick(at)ams(dot)com>, Masse Jacques <jacques(dot)masse(at)bordeaux(dot)cemagref(dot)fr>, <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Do Stored Procedures exist (Besides FUNCTIONs)
Date: 2002-03-04 22:44:58
Message-ID: Pine.BSO.4.40.0203041635500.25700-100000@kitten.greentechnologist.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Mon, 4 Mar 2002, Josh Berkus wrote:
> > 2. Ability to return multiple values ?
> >
> > Are both of these on the TODO list ?.
>
> Just #2. And, as I said, there is some limited ability to return
> mutliple values now. I just don't know how to use it. Hopefully
> another developer will speak up.

I've used the 'SETOF' token to get my functions to return multiple single
attribute tuples. There is some support for returning multiple attributes
but it didn't work well for me so I don't use it.

For the record:

CREATE TABLE bran(
flake integer,
fiber integer
);
INSERT INTO bran (1,2);
INSERT INTO bran (2,3);
INSERT INTO bran (3,4);

1 x 1
CREATE FUNCTION blah() RETURNS integer AS '
SELECT flake FROM bran;
' LANGUAGE 'sql';

returns a single row

1 x n
CREATE FUNCTION blan() RETURNS SETOF integer AS '
SELECT flake FROM bran;
' LANGUAGE 'sql';

returns all the

n x 1
CREATE FUNCTION blah() RETURNS bran AS '
SELECT * FROM bran;
' LANGUAGE 'sql';

Returns an oid, use the projection syntax to get the individual
attributes:

SELECT flake(blah()), fiber(blah());

n x n
CREATE FRUNCTION blah() RETURNS SETOF bran AS '
SELECT * FROM bran;
' LANGUAGE 'sql';

SELECT flake(blah()), fiber(blah());

Joshua b. Jore
http://www.greentechnologist.org

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (OpenBSD)
Comment: For info see http://www.gnupg.org

iD8DBQE8g/jtfexLsowstzcRAmHTAKCaZjZ3OOMVxUo0yiHU0cd9on7PFgCg7VL4
P5l42NyWNSlpOPI+a2a4GBA=
=ed42
-----END PGP SIGNATURE-----