"Nikolay Samokhvalov" <samokhvalov@gmail.com> writes:
> 1. Is it correct at all to use SRF in select list, w/o explicit FROM?
You can read about the current behavior in ExecTargetList, but basically
the idea is to cycle all the SRFs until they all say "done" at the same
time. So the number of result rows is the least common multiple of the
sizes of the SRF outputs.
This behavior is pretty random, I agree, but we inherited it from
Berkeley ... and even if we didn't care about breaking existing
applications that might rely on it, it's not exactly clear what it
should be instead.
The fact that there isn't any obviously right behavior is why I'd
prefer to deprecate SRFs in targetlists ...
regards, tom lane