Re: returning composite types.

From: Joe Conway <mail(at)joeconway(dot)com>
To: Franco Bruno Borghesi <franco(at)akyasociados(dot)com(dot)ar>
Cc: list(at)racistnames(dot)com, pgsql-sql(at)postgresql(dot)org
Subject: Re: returning composite types.
Date: 2003-03-29 16:49:15
Message-ID: 3E85CE8B.3010700@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Franco Bruno Borghesi wrote:
> ok, soy you're telling me that the only way to return a composite type is
> using a set of them, even if I know my function will allways return 1 record.

Try this:

create type foo as (f1 int, f2 text);
create or replace function retfoo(int, text) returns foo as '
declare
result foo%ROWTYPE;
begin
select into result $1, $2;
return result;
end;
' language 'plpgsql';

regression=# select * from retfoo(2,'b');
f1 | f2
----+----
2 | b
(1 row)

Joe

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Franco Bruno Borghesi 2003-03-29 17:35:04 Re: returning composite types.
Previous Message Franco Bruno Borghesi 2003-03-29 16:20:05 Re: returning composite types.