Function returning RECORD - Mailing list pgsql-general

From Cristian Custodio
Subject Function returning RECORD
Date
Msg-id 004201c2e830$8c8cb0e0$fb01a8c0@ttcristian
Whole thread Raw
List pgsql-general
Hi,

I'm not be able to use a function to return the record type.

AnyBody could help me? Look this exemple:

CREATE OR REPLACE FUNCTION TESTERECORD()
RETURNS record AS '
DECLARE
vRecRetorno Record;
BEGIN
 SELECT teste INTO vRecRetorno FROM (SELECT ''Function record '' AS teste) AS TABELA;
 RETURN vRecRetorno;
END;
' language 'plpgsql';
 
 
 
CREATE OR REPLACE FUNCTION TESTECHAMARECORD()
RETURNS varchar AS '
DECLARE
vrecord RECORD;
v varchar;
BEGIN
 SELECT testerecord() INTO vrecord;
 v := vrecord.teste; -- Here is the error
 RETURN v;
end;
' language 'plpgsql';
 

select testechamarecord();

When I call the testechamarecord function, the following message error appear:

record "vrecord" has no field named "teste"
 

Help-me, please.

Cristian Luciano Custodio

pgsql-general by date:

Previous
From: Luis Tena
Date:
Subject: TO ADMIN: E-mail change
Next
From: Stephen Robert Norris
Date:
Subject: Re: pg_dump strangeness