Re: [SQL] function return multiply rows

From: Joe Conway <mail(at)joeconway(dot)com>
To: Jeroen Olthof <j(dot)olthof(at)millipede(dot)nl>
Cc: pgsql-general(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org
Subject: Re: [SQL] function return multiply rows
Date: 2002-09-27 16:44:55
Message-ID: 3D948B07.5050205@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2002-09-27 16:51:50 Re: query speed depends on lifetime of frozen db?
Previous Message Bruce Momjian 2002-09-27 16:41:14 Re: [JDBC] Prepared statement performance...

Browse pgsql-sql by date

  From Date Subject
Next Message Jean-Luc Lachance 2002-09-27 17:23:49 Re: Dublicates pairs in a table.
Previous Message Richard Huxton 2002-09-27 16:37:43 Re: Dublicates pairs in a table.