Re: Returning multiple values (but one row) in plpgsql - Mailing list pgsql-general

From Joe Conway
Subject Re: Returning multiple values (but one row) in plpgsql
Date
Msg-id 413F6FAC.1000909@joeconway.com
Whole thread Raw
In response to Re: Returning multiple values (but one row) in plpgsql  ("Karl O. Pinc" <kop@meme.com>)
Responses Re: Returning multiple values (but one row) in plpgsql
List 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

pgsql-general by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: information schema table names in 8.0.0
Next
From: "Karl O. Pinc"
Date:
Subject: Re: Returning multiple values (but one row) in plpgsql