Re: [SQL] function return multiply rows - Mailing list pgsql-general

From Joe Conway
Subject Re: [SQL] function return multiply rows
Date
Msg-id 3D948B07.5050205@joeconway.com
Whole thread Raw
Responses Re: [SQL] function return multiply rows
List pgsql-general
Jeroen Olthof wrote:
> What is going wrong here?
>
> An example of what I'm trying to do.
>
> vw_teams is a view but same problem when trying it on a single table
> CREATE FUNCTION test() RETURNS SETOF vw_teams AS 'select * from vw_teams;'
> LANGUAGE 'sql';
>
> SELECT test();
>
> results in
>
>    test
> -----------
>  137789256
>  137789256
> (2 rows)

The capability to return composite types (multi-column rows) is limited in <=
PostgreSQL 7.2.x. What you are seeing are pointers to the rows, not the rows
themselves.

Version 7.3, in beta testing now, will do what you are looking for. If you
can, please give it a try. See:
   http://developer.postgresql.org/docs/postgres/xfunc-tablefunctions.html
for more info and examples.

HTH,

Joe


pgsql-general by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [JDBC] Prepared statement performance...
Next
From: Tom Lane
Date:
Subject: Re: query speed depends on lifetime of frozen db?