Re: functions returning records - Mailing list pgsql-hackers

From Alex Pilosov
Subject Re: functions returning records
Date
Msg-id Pine.BSO.4.10.10106262207190.7004-100000@spider.pilosoft.com
Whole thread Raw
In response to Re: functions returning records  (reinoud@xs4all.nl (Reinoud van Leeuwen))
List pgsql-hackers
On Tue, 26 Jun 2001, Reinoud van Leeuwen wrote:

> Coming from a Sybase environment I would love to have functions return
> a result set. A few things to think of:
> 1: will it be possible to return multiple result sets? (in Sybase any
> select statement that is not redirected to variables or a table goes
> to the client, so it is quite common to do multiple selects). Does the
> postgresql client library support this?
No, libpq protocol cannot support that. This is really a sybasism, as good
as it is, no other database supports anything like that.

> 2: will it be possible to put a single result set in a table.
> Something like "resultfunction (argument) INTO TABLENAME" or "INSERT
> INTO TABLENAME resultfunction(argument)

It will be, but syntax will be:
select * into tablename from resultfunction(arg)
insert into tablename select * from resultfunction(arg)

(I.E. resultfunction must be in the 'from' clause)

-alex



pgsql-hackers by date:

Previous
From: "Dmitry G. Mastrukov"
Date:
Subject: Re: New data type: uniqueidentifier
Next
From: Jim Mercer
Date:
Subject: Re: Re: Encrypting pg_shadow passwords