X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D59299DC9A8 for ; Mon, 27 Mar 2006 09:32:53 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 59053-05 for ; Mon, 27 Mar 2006 09:32:57 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from a2s5.a2hosting.com (host-209-124-50-10.a2webhosting.com [209.124.50.10]) by postgresql.org (Postfix) with ESMTP id 774BA9DC99E for ; Mon, 27 Mar 2006 09:32:51 -0400 (AST) Received: from adsl-6-40-254.tys.bellsouth.net ([65.6.40.254] helo=[192.168.1.10]) by a2s5.a2hosting.com with esmtpsa (TLSv1:RC4-SHA:128) (Exim 4.52) id 1FNrpz-00063I-4M; Mon, 27 Mar 2006 08:32:51 -0500 In-Reply-To: <4427C15C.5070905@logix-tt.com> References: <20060324200036.ED8E52C1503@netnation.refractions.net> <1143278826.44250cea7eccc@web-mail1.uibk.ac.at> <4427BFE4.8050500@logix-tt.com> <4427C15C.5070905@logix-tt.com> Mime-Version: 1.0 (Apple Message framework v746.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <7DB6EE64-AB49-4DA6-B690-21A53FD6045E@pgedit.com> Cc: PostGIS Users Discussion , PostgreSQL SQL List Content-Transfer-Encoding: 7bit From: John DeSoi Subject: Re: Problem using set-returning functions Date: Mon, 27 Mar 2006 08:32:39 -0500 To: Markus Schaber X-Mailer: Apple Mail (2.746.2) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - a2s5.a2hosting.com X-AntiAbuse: Original Domain - postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - pgedit.com X-Source: X-Source-Args: X-Source-Dir: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.116 required=5 tests=[AWL=0.116] X-Spam-Score: 0.116 X-Spam-Level: X-Archive-Number: 200603/414 X-Sequence-Number: 24760 On Mar 27, 2006, at 5:41 AM, Markus Schaber wrote: > navteq=# select foo,generate_x(bar) from test; > ERROR: set-valued function called in context that cannot accept a set > CONTEXT: PL/pgSQL function "generate_x" line 5 at return next > > However, it is fine to call other set returning functions in the same > context: With SRFs, you need to specify what you want to select. In other words if you are calling generate_x(bar) you need "select * from generate_x(bar)" -- "select generate_x(bar)" will not work. So for your query I think you need something like: select foo, (select x from generate_x(bar)) from test; John DeSoi, Ph.D. http://pgedit.com/ Power Tools for PostgreSQL