| From: | Joe Conway <mail(at)joeconway(dot)com> |
|---|---|
| To: | "Karl O(dot) Pinc" <kop(at)meme(dot)com> |
| Cc: | Ron St-Pierre <rstpierre(at)syscor(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org> |
| Subject: | Re: Returning multiple values (but one row) in plpgsql |
| Date: | 2004-09-08 20:46:36 |
| Message-ID: | 413F6FAC.1000909@joeconway.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
Karl O. Pinc wrote:
> Anybody got a better idea? Anybody know just when
> this was fixed? If I knew I might be able to see about
> getting our site upgraded. (I tried looking in the CVS
> web interface, but was quickly daunted by the number of
> source files.)
select version();
version
-------------------------------------------------------------------------
PostgreSQL 7.3.7 on x86_64-unknown-linux-gnu, compiled by GCC gcc
(GCC) 3.3.3 20040412 (Red Hat Linux 3.3.3-7)
(1 row)
CREATE TYPE returntype AS (a INT, b INT);
CREATE OR REPLACE FUNCTION return_multiple()
RETURNS setof returntype
LANGUAGE plpgsql
AS '
DECLARE
myvar returntype%rowtype;
BEGIN
myvar.a := 1;
myvar.b := 2;
RETURN NEXT myvar;
RETURN;
END;
';
SELECT * FROM return_multiple();
a | b
---+---
1 | 2
(1 row)
HTH,
Joe
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Gaetano Mendola | 2004-09-08 20:51:00 | Re: Salt in encrypted password in pg_shadow |
| Previous Message | Karl O. Pinc | 2004-09-08 20:35:51 | Re: Returning multiple values (but one row) in plpgsql |