X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 05B8DD1BAD8 for ; Mon, 23 Feb 2004 13:22:06 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 90206-02 for ; Mon, 23 Feb 2004 09:22:07 -0400 (AST) Received: from mta07-svc.ntlworld.com (mta07-svc.ntlworld.com [62.253.162.47]) by svr1.postgresql.org (Postfix) with ESMTP id 958C8D1BA98 for ; Mon, 23 Feb 2004 09:22:03 -0400 (AST) Received: from mta7-svc ([10.137.100.95]) by mta07-svc.ntlworld.com (InterMail vM.4.01.03.37 201-229-121-137-20020806) with SMTP id <20040223132208.MQDR10961.mta07-svc.ntlworld.com@mta7-svc> for ; Mon, 23 Feb 2004 13:22:08 +0000 X-Originating-IP: [212.137.16.6] From: To: pgsql-sql@postgresql.org Subject: plpgsql function returning SETOF RECORD Question Date: Mon, 23 Feb 2004 13:21:32 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Message-Id: <20040223132208.MQDR10961.mta07-svc.ntlworld.com@mta7-svc> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200402/391 X-Sequence-Number: 17081 Hi When I run the function below I recieve an error message saying that column definitions need to be specified for a function returing a type RECORD. I was under the impression that the FOR row IN SELECT... loop would assign a column structure to the RECORD type. Am I wrong about this? CREATE FUNCTION test() RETURNS SETOF RECORD AS ' DECLARE row RECORD; BEGIN FOR row IN SELECT * FROM dates LOOP RETURN NEXT row; END LOOP; RETURN; END; ' LANGUAGE 'plpgsql'; PostgreSQL 7.3.2-3 on Red Hat 9. Regards John Duffy ----------------------------------------- Email provided by http://www.ntlhome.com/