Function returning record - Mailing list pgsql-general

From alla@sergey.com (Alla)
Subject Function returning record
Date
Msg-id 9275d56e.0106071053.2f5d8d8f@posting.google.com
Whole thread Raw
Responses Re: Function returning record  ("Thalis A. Kalfigopoulos" <thalis@cs.pitt.edu>)
List pgsql-general
Is it possible in PostgreSQL to write a function that would return a
record type.

What I need is something like this:

create function my_func(varchar)
return record as '
declare
   my_rec   record;
begin
   select null as field1, null as field2
   into my_rec;

   .... some processing to populate the actual values of the record

   return my_rec;
end;
' LANGUAGE 'plpgsql';


I get the following when I try to compile this:
NOTICE:  ProcedureCreate: return type 'record' is only a shell

and following when I try to execute it (even though I am not sure how
to execute this at all);
ERROR:  fmgr_info: function 0: cache lookup failed

Please help.

Thanks a lot in advance

Alla

pgsql-general by date:

Previous
From: Nicolas Huillard
Date:
Subject: RE: Exploring sequences (sequence context within a transaction)
Next
From: "John Moo"
Date:
Subject: Re: [newbie] Relations...