Simon Riggs <simon(at)2ndQuadrant(dot)com> writes:
> (On another thought: why do Foreign Scans get to avoid the
> materialization we hate with SRFs?)
[ shrug... ] That works both ways. If it would be convenient for an
FDW to return a tuplestore, which is hardly unlikely, it's out of luck;
it has to do the expansion itself.
The fact that nodeFunctionscan forces materialization is not by any
means a fundamental property. It's just that nobody bothered to
implement two code paths there.
regards, tom lane