SETOF RECORD RETURN VALUE

From: "Christian Paul B(dot) Cosinas" <cpc(at)cybees(dot)com>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: SETOF RECORD RETURN VALUE
Date: 2005-10-26 10:34:44
Message-ID: 000001c5da18$e1d9ba20$1e21100a@ghwk02002147
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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
LOOP
RETURN 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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Sean Davis 2005-10-26 10:58:16 Re: SETOF RECORD RETURN VALUE
Previous Message Marc G. Fournier 2005-10-26 09:48:41 Re: pl/* overhead ...