X-Original-To: pgsql-sql@postgresql.org Received: from sabre.velocet.net (sabre.velocet.net [216.138.209.205]) by postgresql.org (Postfix) with ESMTP id 7EC4F4762EE for ; Wed, 5 Mar 2003 08:36:27 -0500 (EST) Received: from stark.dyndns.tv (H162.C233.tor.velocet.net [216.138.233.162]) by sabre.velocet.net (Postfix) with ESMTP id 39F56138254; Wed, 5 Mar 2003 08:36:30 -0500 (EST) Received: from localhost ([127.0.0.1] helo=stark.dyndns.tv ident=foobar) by stark.dyndns.tv with smtp (Exim 3.36 #1 (Debian)) id 18qZ4P-0001l9-00; Wed, 05 Mar 2003 08:36:29 -0500 To: Christoph Haller Cc: pgsql-sql@postgresql.org, fernando@icreativa.com.mx, gsstark@MIT.EDU Subject: Re: SETOF References: <3E65F78E.7455651B@rodos.fzk.de> In-Reply-To: <3E65F78E.7455651B@rodos.fzk.de> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 05 Mar 2003 08:36:29 -0500 Message-ID: <87u1ei7x5u.fsf@stark.dyndns.tv> Lines: 27 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Archive-Number: 200303/151 X-Sequence-Number: 12191 Christoph Haller writes: > > > > > > Christoph Haller writes: > > > > > You cannot obtain several columns from SQL functions. > > > See the list archives (search for SETOF) for details. > > > You have to use e.g. a plpgsql function instead. > > > > How do you do it with a plpgsql function? > > And Greg, refer to > http://techdocs.postgresql.org/guides/SetReturningFunctions > > I think it will fit your needs. That document describes using the function in the from list of the select. That's equivalent to converting the query to a join, which isn't always possible or convenient. I was talking about using a subquery or function in the output column list to produce multiple output columns. I'm sorry I may have muddied the waters in that it sounds like my comment wasn't about exactly the same issue as Chistoph's. -- greg