plpgsql : column definition list

From: Masse Jacques <jacques(dot)masse(at)bordeaux(dot)cemagref(dot)fr>
To: pgsql-novice(at)postgresql(dot)org
Subject: plpgsql : column definition list
Date: 2004-08-03 16:02:37
Message-ID: 0B87317EA62BD211A02A00A0C9DFB7EC9B6011@hermes.bordeaux.cemagref.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

The result of the function test() should be a list of integer coming from a
column "ech_id" from a recursive function
data.sp_ech_recurs_desc_a(integer).

I have the following message:
ERROR: a column definition list is required for functions returning
"record"

How to define this list in this function ?

Thanks
--------
CREATE OR REPLACE FUNCTION test()
RETURNS SETOF record AS
'
declare
parent integer;
rec RECORD;
begin
... a "SELECT INTO parent ..." giving a value to the variable parent
...
FOR rec IN SELECT ech_id from data.sp_ech_recurs_desc_a(parent) LOOP
RETURN NEXT rec;
END LOOP;
return;
end
'
LANGUAGE 'plpgsql' VOLATILE;
------------

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Joe Conway 2004-08-03 16:13:47 Re: plpgsql : column definition list
Previous Message michael 2004-08-03 15:04:04 Re: help with COPY from .csv file into database