From: Christian Paul B. Cosinas <cpc@cybees.com>
To: pgsql-sql@postgresql.org
Subject: SETOF RECORD RETURN VALUE
Date: Wed, 26 Oct 2005 10:34:44 -0000
Message-ID: <000001c5da18$e1d9ba20$1e21100a@ghwk02002147> (raw)
In-Reply-To: <20051026113142.25ec9045@svb.ucs.co.za>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: cpc@cybees.com
Subject: Re: SETOF RECORD RETURN VALUE
In-Reply-To: <000001c5da18$e1d9ba20$1e21100a@ghwk02002147>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox