message: Test case with binding failures inside a window function
diff: @@ -531,3 +531,23 @@ TEST_CASE("Ensure dbplyr crash with ORDER BY under window stays fixed", "[window
  REQUIRE(CHECK_COLUMN(result, 0, {3,3,4}));
  REQUIRE(CHECK_COLUMN(result, 1, {1.0,2.0,2.0}));
  }
  +
  +TEST_CASE("Test errors in binding window functions", "[window]") {
  + unique_ptr<QueryResult> result;
  + DuckDB db(nullptr);
  + Connection con(db);
  + con.EnableQueryVerification();
  +
  + REQUIRE_NO_FAIL(con.Query("CREATE TABLE integers(i INTEGER)"));
  +
  + // we use columns here that are not part of the table
  + REQUIRE_FAIL(con.Query("SELECT MIN(a) OVER (PARTITION BY i ORDER BY i) FROM integers"));
  + REQUIRE_FAIL(con.Query("SELECT MIN(i) OVER (PARTITION BY a ORDER BY i) FROM integers"));
  + REQUIRE_FAIL(con.Query("SELECT MIN(i) OVER (PARTITION BY i ORDER BY a) FROM integers"));
  + REQUIRE_FAIL(con.Query("SELECT MIN(i) OVER (PARTITION BY i, a ORDER BY i) FROM integers"));
  + REQUIRE_FAIL(con.Query("SELECT MIN(i) OVER (PARTITION BY i ORDER BY i, a) FROM integers"));
  +
  + // now we only use the "proper" columns
  + result = con.Query("SELECT MIN(i) OVER (PARTITION BY i ORDER BY i) FROM integers");
  + REQUIRE(CHECK_COLUMN(result, 0, {}));
  +}
  