Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumSQLrecursive CTEsSingle-choice MCQ

This recursive CTE has no termination condition on cyclic data (a graph with a cycle). In an engine without an automatic cycle guard, what happens?

WITH RECURSIVE walk(id, nxt) AS ( SELECT id, nxt FROM edges WHERE id = 1 UNION ALL SELECT e.id, e.nxt FROM edges e JOIN walk w ON e.id = w.nxt ) SELECT * FROM walk;