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

Re: first cut at PL/PgSQL table functions

From: Joe Conway <mail(at)joeconway(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Neil Conway <neilc(at)samurai(dot)com>,PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: first cut at PL/PgSQL table functions
Date: 2002-08-20 15:56:26
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-patches
Tom Lane wrote:
> Neil Conway <neilc(at)samurai(dot)com> writes:
>>Yeah, I agree that special-casing PL/PgSQL is kludgy. Did you read the
>>addendum I posted to my original mail on -patches? Joe Conway and I
>>were discussing how to improve this mechanism -- the idea Joe
>>suggested was to add a new FunctionMode for "this function provides a
>>tuple store", and then add the necessary grammar smarts to make the
>>function mode a property of CREATE FUNCTION. Let me know if I haven't
>>explained Joe's idea in sufficient depth.
> I see no reason to push it into the grammar.  Any one SRF is unlikely to
> support more than one return mode (eg, plpgsql SRFs won't) so having the
> function tell the appropriate mode on first call would be sufficient.
> Also, if we push it into the grammar how do we get the user to get it
> right?

Well one reason is that in the future we might want to be able to 
specify a *sorted* FunctionMode and make use of that in the optimizer. 
But I suppose the concept of "sorted" is orthogonal to the "mode" (i.e. 
we can send sorted results either by steaming or as a tuplestore batch).

So how do we pass the mode info from the function back up the line to 
FunctionNext? Would it make sense to add a member to ExprContext? It 
gets passed in to the function as part of ReturnSetInfo.

> It's quite likely that that won't work at present, depending on what
> sort of context-flinging is done in nodeFunctionscan.  I need to review
> that code and see if I think the context handling is good or not.
> Will try to look today.

Does a good primer on proper backend memory-context handling exist? If 
so I'd love a cheat-sheet version that I could laminate ;-)


In response to


pgsql-patches by date

Next:From: Rod TaylorDate: 2002-08-20 15:57:31
Subject: Correct regression tests
Previous:From: Tom LaneDate: 2002-08-20 15:34:41
Subject: Re: Truncate

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