Re: possible memory leak with SRFs

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Nikhil Sontakke <nikhil.sontakke@enterprisedb.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2010-05-07T15:09:04Z
Lists: pgsql-hackers
Nikhil Sontakke <nikhil.sontakke@enterprisedb.com> writes:
>> Consider
>>    srf(foo(col))
>> where foo returns a pass-by-reference datatype.

> Yeah this is my basic confusion. But wouldn't the arguments be
> evaluated afresh on the subsequent call for this SRF?

No, see ExecMakeFunctionResult().  If we did that we'd have serious
problems with volatile functions, ie srf(random()).

			regards, tom lane