title: Redirect output of one recursive query into another recursive query
body: <p>I wanted to find the topological sort of a DAG.</p>
  <pre><code>CREATE TABLE topo(
  v1 int,
  v2 int
  );
  
  INSERT INTO topo VALUES (1,3),(2,5),(3,4),(4,5),(4,6),(5,7),(6,5),(7,null)
  
  WITH RECURSIVE path(S,d) AS(
   SELECT t1.v1, 0 FROM topo t1 LEFT OUTER JOIN topo AS t2 ON t1.v1=t2.v2 
   WHERE t2.v2 IS NULL
   UNION ALL
   SELECT DISTINCT t1.v2, path.d + 1 FROM path INNER JOIN topo AS t1 ON 
   t1.v1=path.S
  )
  SELECT S FROM path GROUP BY S ORDER BY MAX(d);
  </code></pre>
  <p>This code gives the output of the topological order of a graph. Now I want to use this output into another recursive query to find the path from one vertex to another.</p>
  <p>Can I use the output generated by this code into another recursive query?</p>