[postgis-users] Problem using set-returning functions
Markus Schaber
schabi at logix-tt.com
Mon Mar 27 06:29:51 PST 2006
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
More information about the postgis-users
mailing list