| 1 | #include "catch.hpp" | 
|---|---|
| 2 | #include "test_helpers.hpp" | 
| 3 | |
| 4 | using namespace duckdb; | 
| 5 | using namespace std; | 
| 6 | |
| 7 | TEST_CASE( "Test filter on alias", "[filter]") { | 
| 8 | unique_ptr<QueryResult> result; | 
| 9 | DuckDB db(nullptr); | 
| 10 | Connection con(db); | 
| 11 | con.EnableQueryVerification(); | 
| 12 | |
| 13 | REQUIRE_NO_FAIL(con.Query( "CREATE TABLE integers(i INTEGER)")); | 
| 14 | REQUIRE_NO_FAIL(con.Query( "INSERT INTO integers VALUES (1), (2), (3), (NULL)")); | 
| 15 | |
| 16 | // this fails in postgres and monetdb, but succeeds in sqlite | 
| 17 | // for now, we have this fail as well because it simplifies our life | 
| 18 | // the filter occurs before the projection, hence "j" is not computed until AFTER the filter normally | 
| 19 | REQUIRE_FAIL(con.Query( "SELECT i % 2 AS j FROM integers WHERE j<>0;")); | 
| 20 | } | 
| 21 | 
