1 | #include "catch.hpp" |
2 | #include "duckdb/common/file_system.hpp" |
3 | #include "dbgen.hpp" |
4 | #include "test_helpers.hpp" |
5 | |
6 | using namespace duckdb; |
7 | using namespace std; |
8 | |
9 | TEST_CASE("Test joins on VARCHAR columns with NULL values" , "[join]" ) { |
10 | unique_ptr<QueryResult> result; |
11 | DuckDB db(nullptr); |
12 | Connection con(db); |
13 | con.EnableQueryVerification(); |
14 | |
15 | result = con.Query("select * from (select NULL::varchar as b) sq1, (select 'asdf' as b) sq2 where sq1.b = sq2.b;" ); |
16 | REQUIRE(CHECK_COLUMN(result, 0, {})); |
17 | |
18 | result = con.Query("select * from (select 42 as a, NULL::varchar as b) sq1, (select 42 as a, 'asdf' as b) sq2 " |
19 | "where sq1.b <> sq2.b;" ); |
20 | REQUIRE(CHECK_COLUMN(result, 0, {})); |
21 | |
22 | result = con.Query("select * from (select 42 as a, NULL::varchar as b) sq1, (select 42 as a, 'asdf' as b) sq2 " |
23 | "where sq1.a=sq2.a and sq1.b <> sq2.b;" ); |
24 | REQUIRE(CHECK_COLUMN(result, 0, {})); |
25 | |
26 | result = con.Query("select * from (select 42 as a, 'asdf' as b) sq2, (select 42 as a, NULL::varchar as b) sq1 " |
27 | "where sq1.b <> sq2.b;" ); |
28 | REQUIRE(CHECK_COLUMN(result, 0, {})); |
29 | |
30 | result = con.Query("select * from (select 42 as a, 'asdf' as b) sq2, (select 42 as a, NULL::varchar as b) sq1 " |
31 | "where sq1.a=sq2.a and sq1.b <> sq2.b;" ); |
32 | REQUIRE(CHECK_COLUMN(result, 0, {})); |
33 | } |
34 | |