1#include "catch.hpp"
2#include "duckdb/common/file_system.hpp"
3#include "dbgen.hpp"
4#include "test_helpers.hpp"
5
6using namespace duckdb;
7using namespace std;
8
9TEST_CASE("MonetDB Test: boolean_not.Bug-3505.sql", "[monetdb]") {
10 unique_ptr<QueryResult> result;
11 DuckDB db(nullptr);
12 Connection con(db);
13 con.EnableQueryVerification();
14
15 REQUIRE_NO_FAIL(con.Query("CREATE TABLE BOOLTBL1 (f1 bool);"));
16 REQUIRE_NO_FAIL(con.Query("INSERT INTO BOOLTBL1 (f1) VALUES (cast('true' AS boolean));"));
17 REQUIRE_NO_FAIL(con.Query("INSERT INTO BOOLTBL1 (f1) VALUES ('true');"));
18 REQUIRE_NO_FAIL(con.Query("INSERT INTO BOOLTBL1 (f1) VALUES ('false');"));
19
20 result = con.Query("SELECT f1 FROM BOOLTBL1 WHERE f1 = NOT FALSE;");
21 REQUIRE(CHECK_COLUMN(result, 0, {true, true}));
22 result = con.Query("SELECT f1 FROM BOOLTBL1 WHERE f1 = NOT TRUE;");
23 REQUIRE(CHECK_COLUMN(result, 0, {false}));
24
25 result = con.Query("SELECT f1 FROM BOOLTBL1 WHERE f1 = (NOT FALSE);");
26 REQUIRE(CHECK_COLUMN(result, 0, {true, true}));
27 result = con.Query("SELECT f1 FROM BOOLTBL1 WHERE NOT FALSE = f1;");
28 REQUIRE(CHECK_COLUMN(result, 0, {true, true}));
29 result = con.Query("SELECT f1 FROM BOOLTBL1 WHERE NOT f1 = FALSE;");
30 REQUIRE(CHECK_COLUMN(result, 0, {true, true}));
31
32 result = con.Query("SELECT f1 FROM BOOLTBL1 WHERE f1 = (NOT TRUE);");
33 REQUIRE(CHECK_COLUMN(result, 0, {false}));
34 result = con.Query("SELECT f1 FROM BOOLTBL1 WHERE NOT TRUE = f1;");
35 REQUIRE(CHECK_COLUMN(result, 0, {false}));
36 result = con.Query("SELECT f1 FROM BOOLTBL1 WHERE NOT f1 = TRUE;");
37 REQUIRE(CHECK_COLUMN(result, 0, {false}));
38}
39