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

Re: functions returning records

From: Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
To: Alex Pilosov <alex(at)pilosoft(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: functions returning records
Date: 2001-06-27 07:10:52
Message-ID: 20010627091051.H10253@ara.zf.jcu.cz (view raw or flat)
Thread:
Lists: pgsql-hackers
On Tue, Jun 26, 2001 at 05:11:47PM -0400, Alex Pilosov wrote:
> I started thinking about Tom's idea to implement functions as table
> source.
> 
> To me, it seems that a very few changes are necessary:
> a) parser must be changed to allow functioncall to be a table_ref
> (easy)
> 
> b) when a Query node is generated out of such a call "select * from foo()"
> it should be almost identical to one generated out of "select * from
> (select * from foo)" with one distinction: list of query attributes should
> be completed based on return type of foo().

 For the result from foo() you must somewhere define attributes (names). 
Where? In CREATE FUNCTION statement? Possible must be:

 select name1, name2 from foo() where name1 > 10;

 What returns foo()? ...the pointer to HeapTuple or something like this or
pointer to some temp table?

> c) executor should support execution of such Query node, properly
> extracting things out of function's return value and placing them into
> result attributes.

 d) changes in fmgr

 e) SPI support for table building/filling inside foo()


 IMHO very cool and nice feature, but not easy for imlementation.

			Karel 

-- 
 Karel Zak  <zakkr(at)zf(dot)jcu(dot)cz>
 http://home.zf.jcu.cz/~zakkr/
 
 C, PostgreSQL, PHP, WWW, http://docs.linux.cz, http://mape.jcu.cz

In response to

Responses

pgsql-hackers by date

Next:From: Oleg BartunovDate: 2001-06-27 08:17:26
Subject: Non-trivial rewriting sql query
Previous:From: Richard HuxtonDate: 2001-06-27 07:00:01
Subject: Re: Bug in createlang?

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