Thanks! I was not declaring the variable %rowtype.
Adding that fixed the problem.
On 2004.09.08 15:46 Joe Conway wrote:
> 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
Karl <kop@meme.com>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein