Re: returning composite types. - Mailing list pgsql-sql

From Joe Conway
Subject Re: returning composite types.
Date
Msg-id 3E85CE8B.3010700@joeconway.com
Whole thread Raw
In response to Re: returning composite types.  (Franco Bruno Borghesi <franco@akyasociados.com.ar>)
Responses Re: returning composite types.  (Franco Bruno Borghesi <franco@akyasociados.com.ar>)
List 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



pgsql-sql by date:

Previous
From: Franco Bruno Borghesi
Date:
Subject: Re: returning composite types.
Next
From: Franco Bruno Borghesi
Date:
Subject: Re: returning composite types.