message: Add some test cases for recursive CTEs
diff: @@ -44,3 +44,26 @@ TEST_CASE("Test Common Table Expressions (CTE)", "[cte]") {
  "where j = (select max(j) from cte1 as cte2);");
  REQUIRE(CHECK_COLUMN(result, 0, {42}));
  }
  +
  +TEST_CASE("Test Recursive Common Table Expressions (CTE)", "[rec_cte]") {
  + unique_ptr<QueryResult> result;
  + DuckDB db(nullptr);
  + Connection con(db);
  + con.EnableQueryVerification();
  +
  + // simple recursive CTE
  + result = con.Query("with recursive t as (select 1 as x union all select x+1 from t where x < 3) select * from t");
  + REQUIRE(CHECK_COLUMN(result, 0, {1, 2, 3}));
  +
  + // simple recursive CTE with an alias
  + result = con.Query("with recursive t as (select 1 as x union all select x+1 from t as m where m.x < 3) select * from t");
  + REQUIRE(CHECK_COLUMN(result, 0, {1, 2, 3}));
  +
  + // recursive CTE with multiple references and aliases
  + result = con.Query("with recursive t as (select 1 as x union all select m.x+f.x from t as m, t as f where m.x < 3) select * from t");
  + REQUIRE(CHECK_COLUMN(result, 0, {1, 2, 4}));
  +
  +
  + // aggregate functions are not allowed in the recursive term of ctes
  + REQUIRE_FAIL(con.Query("with recursive t as (select 1 as x union all select sum(x+1) from t where x < 3) select * from t"));
  +}
  \ No newline at end of file
  