X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B3C47DAC90 for ; Wed, 26 Oct 2005 07:30:31 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 38610-01 for ; Wed, 26 Oct 2005 10:30:27 +0000 (GMT) Received: from mailer.eglobalreach.net (gc4-mx.gc4.com [202.124.128.22]) by svr1.postgresql.org (Postfix) with ESMTP id 0DDB3DAC32 for ; Wed, 26 Oct 2005 07:30:27 -0300 (ADT) Received: from ghwk02002147 (localhost [127.0.0.1] (may be forged)) by mailer.eglobalreach.net (8.11.6p2/) with ESMTP id j9QAUUh31260 for ; Wed, 26 Oct 2005 18:30:30 +0800 From: "Christian Paul B. Cosinas" To: Subject: SETOF RECORD RETURN VALUE Date: Wed, 26 Oct 2005 10:34:44 -0000 Message-ID: <000001c5da18$e1d9ba20$1e21100a@ghwk02002147> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 thread-index: AcXaEKc8kk/GQV6xQda70GytIaMzAQAB5skA X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1506 In-Reply-To: <20051026113142.25ec9045@svb.ucs.co.za> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.965 required=5 tests=[AWL=-0.286, FORGED_RCVD_HELO=0.05, SUBJ_ALL_CAPS=0.365, UPPERCASE_25_50=0.207, URIBL_SBL=0.629] X-Spam-Level: X-Archive-Number: 200510/319 X-Sequence-Number: 23172 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