Skip site navigation (1) Skip section navigation (2)

Re: functions returning records

From: Alex Pilosov <alex(at)pilosoft(dot)com>
To: Reinoud van Leeuwen <reinoud(at)xs4all(dot)nl>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: functions returning records
Date: 2001-06-27 02:09:39
Message-ID: Pine.BSO.4.10.10106262207190.7004-100000@spider.pilosoft.com (view raw or flat)
Thread:
Lists: 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


In response to

Responses

pgsql-hackers by date

Next:From: Jim MercerDate: 2001-06-27 02:16:00
Subject: Re: Re: Encrypting pg_shadow passwords
Previous:From: Dmitry G. MastrukovDate: 2001-06-27 01:48:36
Subject: Re: New data type: uniqueidentifier

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group