1 | #include "catch.hpp" |
2 | #include "test_helpers.hpp" |
3 | |
4 | using namespace duckdb; |
5 | using namespace std; |
6 | |
7 | #define COLUMN_COUNT 10000 |
8 | |
9 | #include <fstream> |
10 | |
11 | TEST_CASE("Test many columns" , "[create][.]" ) { |
12 | unique_ptr<QueryResult> result; |
13 | DuckDB db(nullptr); |
14 | Connection con(db); |
15 | |
16 | ostringstream ss; |
17 | // many columns |
18 | ss << "CREATE TABLE integers(" ; |
19 | for (size_t i = 0; i < COLUMN_COUNT; i++) { |
20 | ss << "i" + to_string(i) + " INTEGER, " ; |
21 | } |
22 | ss << "j INTEGER);" ; |
23 | |
24 | auto query = ss.str(); |
25 | |
26 | // big insert |
27 | REQUIRE_NO_FAIL(con.Query(query)); |
28 | |
29 | REQUIRE_NO_FAIL(con.Query("INSERT INTO integers (i0, j) VALUES (2, 3), (3, 4), (5, 6)" )); |
30 | |
31 | result = con.Query("SELECT i0, j, i1 FROM integers" ); |
32 | REQUIRE(CHECK_COLUMN(result, 0, {2, 3, 5})); |
33 | REQUIRE(CHECK_COLUMN(result, 1, {3, 4, 6})); |
34 | REQUIRE(CHECK_COLUMN(result, 2, {Value(), Value(), Value()})); |
35 | } |
36 | |