Ecto: select from generated_series only

Maybe you could try using (lateral) joins to express the subselects? Or maybe a windowing function

Lateral joins would still be fragments, though.