3 ms·
I just found it in my notes. I don't think it looks too bad - everything you were going to do in the recursive part, you just do inside the subquery instead.
by radiowave 7y ago
I just found it in my notes. I don't think it looks too bad - everything you were going to do in the recursive part, you just do inside the subquery instead.
WITH RECURSIVE my_cte AS (
SELECT foo, bar FROM whatever
UNION ALL
SELECT (s).*
FROM my_cte, LATERAL (
SELECT ... -- refer to my_cte multiple times here
) s
)