pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Markus Schaber <schabi@logix-tt.com>
To: PostGIS Users Discussion <postgis-users@postgis.refractions.net>
Cc: PostgreSQL SQL List <pgsql-sql@postgresql.org>
Subject: Re: [postgis-users] Problem using set-returning functions
Date: Mon, 27 Mar 2006 16:29:51 +0200
Message-ID: <4427F6DF.7070104@logix-tt.com> (raw)
In-Reply-To: <35F9812087218F47B050D41D1B58298B86D2F9@dnd5.dnd.boston.cob>
References: <35F9812087218F47B050D41D1B58298B86D2F9@dnd5.dnd.boston.cob>

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



view thread (9+ messages)  latest in thread

Message-ID: <4427F6DF.7070104@logix-tt.com>
Permalink:  ../4427F6DF.7070104@logix-tt.com/
Also on:    postgresql.org/message-id/4427F6DF.7070104@logix-tt.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: schabi@logix-tt.com, postgis-users@postgis.refractions.net
  Subject: Re: [postgis-users] Problem using set-returning functions
  In-Reply-To: <4427F6DF.7070104@logix-tt.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox