3 ms·
If you're talking about recursive common table expressions, those are called recursive, but are really iterative. The PostgreSQL documentation describes the ite
by twic 4y ago
If you're talking about recursive common table expressions, those are called recursive, but are really iterative. The PostgreSQL documentation describes the iterative evaluation:
https://www.postgresql.org/docs/current/queries-with.html#id-1.5.6.12.6.3 https://www.postgresql.org/docs/current/queries-with.html#id...
Note how there is no way to remove a row from the result set once it has been added. That would not be the case with a truly recursive query, because you would be constructing a new result set at every step. As a concrete example, try to write a graph query which finds all nodes exactly three edges from some starting node. That would be trivial with true recursion, but is impossible with a recursive CTE alone.