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 935E19DCD21 for ; Mon, 27 Mar 2006 10:29:39 -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 72025-09 for ; Mon, 27 Mar 2006 10:29:43 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.logix-tt.com (unknown [212.211.145.186]) by postgresql.org (Postfix) with ESMTP id 62D5B9DCBC8 for ; Mon, 27 Mar 2006 10:29:37 -0400 (AST) Received: from kingfisher.intern.logix-tt.com (T938b.t.pppool.de [89.55.147.139]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.logix-tt.com (Postfix) with ESMTP id 398AF657CA; Mon, 27 Mar 2006 16:30:20 +0200 (CEST) Received: from [127.0.0.1] (localhost [127.0.0.1]) by kingfisher.intern.logix-tt.com (Postfix) with ESMTP id ADB9C184ED71E; Mon, 27 Mar 2006 16:29:51 +0200 (CEST) Message-ID: <4427F6DF.7070104@logix-tt.com> Date: Mon, 27 Mar 2006 16:29:51 +0200 From: Markus Schaber Organization: Logical Tracking and Tracing International AG, Switzerland User-Agent: Debian Thunderbird 1.0.7 (X11/20051017) X-Accept-Language: en-us, en MIME-Version: 1.0 To: PostGIS Users Discussion Cc: PostgreSQL SQL List Subject: Re: [postgis-users] Problem using set-returning functions References: <35F9812087218F47B050D41D1B58298B86D2F9@dnd5.dnd.boston.cob> In-Reply-To: <35F9812087218F47B050D41D1B58298B86D2F9@dnd5.dnd.boston.cob> X-Enigmail-Version: 0.93.0.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.109 required=5 tests=[AWL=0.109] X-Spam-Score: 0.109 X-Spam-Level: X-Archive-Number: 200603/422 X-Sequence-Number: 24768 Hi, Regina, Obe, Regina DND\MIS wrote: > Actually I suspect no set returning function created in pgsql will work > the way you are trying to do it. Not sure why. The dump is done in c > and plugged in and I think it explicitly generates a tuple in the target > set for every output. > > Try rewriting your function to something like this and see if it works > > CREATE OR REPLACE FUNCTION generate_x (geom geometry) > RETURNS SETOF double precision AS > ' > SELECT X(geometryn($1,index)) > FROM generate_series(1, npoints($1)) index; > > ' LANGUAGE 'sql' IMMUTABLE STRICT; Yes, it seems to work. This will solve the OPs case. But it is still a good question whether it is possible to accomplish this using plpgsql. Thanks, Markus -- Markus Schaber | Logical Tracking&Tracing International AG Dipl. Inf. | Software Development GIS Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org