SETOF RECORD RETURN VALUE - Mailing list pgsql-sql

From Christian Paul B. Cosinas
Subject SETOF RECORD RETURN VALUE
Date
Msg-id 000001c5da18$e1d9ba20$1e21100a@ghwk02002147
Whole thread Raw
In response to Re: converting epoch to timestamp  (Stef <svb@ucs.co.za>)
Responses Re: SETOF RECORD RETURN VALUE
List pgsql-sql
Hi I am having some problem with function that returns SETOF RECORD

Here is my function:

CREATE OR REPLACE FUNCTION test_record(text) RETURNS SETOF RECORD AS
$BODY$


DECLARE
p_table_name ALIAS FOR $1;
temp_rec RECORD;
v_query text;

BEGIN 

v_query = 'SELECT * FROM ' || p_table_name; FOR temp_rec IN EXECUTE v_query
LOOPRETURN NEXT temp_rec;
END LOOP;

RETURN ;

END;

$BODY$ LANGUAGE 'plpgsql' VOLATILE;


And here is how I execute the function:
select * from test_record('field_list')

I have this error:

ERROR:  a column definition list is required for functions returning
"record"



I choose Polesoft Lockspam to fight spam, and you?
http://www.polesoft.com/refer.html    



pgsql-sql by date:

Previous
From: "Marc G. Fournier"
Date:
Subject: Re: pl/* overhead ...
Next
From: Sean Davis
Date:
Subject: Re: SETOF RECORD RETURN VALUE