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 ---------------------------(end of broadcast)--------------------------- TIP 2: Don't 'kill -9' the postmaster