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

Re: WIP patch: convert SQL-language functions to return tuplestores

From: "Robert Haas" <robertmhaas(at)gmail(dot)com>
To: "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>
Cc: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Dimitri Fontaine" <dfontaine(at)hi-media(dot)com>, pgsql-hackers(at)postgresql(dot)org, "Gregory Stark" <stark(at)enterprisedb(dot)com>, "Martijn van Oosterhout" <kleptog(at)svana(dot)org>
Subject: Re: WIP patch: convert SQL-language functions to return tuplestores
Date: 2008-10-30 17:11:42
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
> With session variables we could implement srf function in plpgsql like
> current C srf function. Like
> create or replace function foo(....)
> returns record as $$
> #option with_srf_context(datatype of srf context)
> begin
>   return row(...);
> end;
> $$ language plpgsql;

Oh, sure - but what you can do with this will be somewhat limited
compared to a Perl hash reference off which you can chain any
arbitrary data structure with ease.  I'd want to see an actual use
case for this before anyone bothered implementing it.  I was actually
thinking one way to do it would be to extend the variable declaration
syntax so that you could declare n>=0 variables as SRF context
variables, which I think is nicer, but even that I think is of limited
usefulness.  I think the biggest value of PL/plgsql is the ability to
RETURN QUERY, and I think the ability to push a lazy execution model
down into that subordinate query is where the win is.  That case won't
be helped at all by this sort of alternate calling convention - in
fact it'll be nearly impossible to even do that at all with this type
of execution model.


In response to


pgsql-hackers by date

Next:From: Joshua D. DrakeDate: 2008-10-30 17:13:16
Subject: Re: Decreasing WAL size effects
Previous:From: Zdenek KotalaDate: 2008-10-30 16:24:46
Subject: [PATCH] HeapTuple version extension + code cleanup

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