Hi, I have been studying this thread for the past few days now and
tried to understand the problem,
I was interested in investigating the part of swapping
tuplestore_end() for tuplestore_clear() for function scan.
> When a Function Scan is rescanned with changed parameters, the function
> is called again and the tuplestore is created anew. With
> rsinfo.returnMode == SFRM_ValuePerCall it's created on the executor side
> by ExecMakeTableFunctionResult(), but with SFRM_Materialize it's created
> by the function itself, so the functions would be affected as well.
> Fixing the SFRM_Materialize case would be possible by allowing the
> tuplestore to be passed to the function and calling tuplestore_clear()
> on it, but that would change the SRF calling convention, which looks
> like a fairly large change, extensions included.
For now I understand that for each rerun, a new tuple store would be
obtained along with new stats, and that it would mean changing srf
calling convention in order for the swap to work, but that would mean
a big change. I have also tried to understand the relevant code path.
So I wanted to try if I could find a way to solve this, as a
first-time contributor, I'd appreciate any feedback on whether my
understanding is correct, and whether changing the calling convention
is the only way here.
Thank You. Regards,
Yash Jadhav