Function returning RECORD

From: "Cristian Custodio" <crstian(at)terra(dot)com(dot)br>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Function returning RECORD
Date: 2003-03-12 00:44:04
Message-ID: 004201c2e830$8c8cb0e0$fb01a8c0@ttcristian
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Browse pgsql-general by date

  From Date Subject
Next Message Stephen Robert Norris 2003-03-12 05:18:39 Re: pg_dump strangeness
Previous Message Luis Tena 2003-03-11 23:56:45 TO ADMIN: E-mail change