[postgis-users] Problem using set-returning functions

Markus Schaber schabi at logix-tt.com
Mon Mar 27 04:42:52 PST 2006

Hi, Mark,

Mark Cave-Ayland wrote:

> Yup, as you probably already know, you need to do: SELECT * FROM
> generate_x(bar) for a SRF. My guess would be that plpgsql is quite strict on
> this test, whereas the C functions probably are not.... not sure whether the
> behaviour is well defined though :(. Probably worth a question about this on
> -hackers.

There was a small thread some weeks ago on the PostgreSQL list
discussing just this problem.

Set returning functions are an ugly special case, for allowing things like:

navteq=# select generate_series(1,4),generate_series(5,8);
 generate_series | generate_series
               1 |               5
               2 |               6
               3 |               7
               4 |               8
(4 rows)

This cannot be expressed in other ways using PostgreSQL. Newer SQL
standard has a feature called "adjacent tables" that provides this
semantics, but it is not implemented in PostgreSQL yet.

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