X-Original-To: pgsql-novice@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id DDA4B474E5C; Thu, 13 Feb 2003 20:59:09 -0500 (EST) Received: from joeconway.com (unknown [63.210.180.150]) by postgresql.org (Postfix) with ESMTP id EC364474E4F; Thu, 13 Feb 2003 20:59:08 -0500 (EST) Received: from [206.19.64.3] (account jconway HELO joeconway.com) by joeconway.com (CommuniGate Pro SMTP 4.0.4) with ESMTP-TLS id 1611297; Thu, 13 Feb 2003 18:34:14 -0800 Message-ID: <3E4C4CFE.6090503@joeconway.com> Date: Thu, 13 Feb 2003 17:57:18 -0800 From: Joe Conway User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.2.1) Gecko/20021130 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Michael Weaver Cc: pgsql-sql@postgresql.org, pgsql-novice@postgresql.org Subject: Re: [SQL] Returning result sets. References: <3B663B41B350D311AEEF00A0C9254563201A6E@VISION1> In-Reply-To: <3B663B41B350D311AEEF00A0C9254563201A6E@VISION1> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200302/178 X-Sequence-Number: 6194 Michael Weaver wrote: > How do I declare a stored function to return a result set. (ie set of > records) > > I can define a function returning " setof record " > but I get an error: > > A column definition list is required for functions returning RECORD > > The docs(7.3) seem to think that this should be ok. > so what is wrong? You need to look a bit closer at the docs ;-) After declaring myfunc() to return setof record, try: select * from my_func() AS (a int8, b int8, c numeric, d numeric); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing - "the column definition list" HTH, Joe