Skip to content

Commit

Permalink
Initialize chunk with correct vector types in ALTER TYPE scan (fixes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
Mytherin committed May 5, 2020
1 parent 289b2ea commit b6a065d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/storage/data_table.cpp
Expand Up @@ -145,7 +145,7 @@ DataTable::DataTable(ClientContext &context, DataTable &parent, idx_t changed_id

vector<TypeId> types;
for (idx_t i = 0; i < bound_columns.size(); i++) {
types.push_back(parent.types[i]);
types.push_back(parent.types[bound_columns[i]]);
}

DataChunk scan_chunk;
Expand Down
7 changes: 7 additions & 0 deletions test/rigger/test_rigger.cpp
Expand Up @@ -696,11 +696,18 @@ TEST_CASE("Tests found by Rigger", "[rigger]") {
REQUIRE(CHECK_COLUMN(result, 1, {Value()}));
}
SECTION("622") {
// UPDATE on altered table results in an error "Could not find node in column segment tree"
REQUIRE_NO_FAIL(con.Query("CREATE TABLE t0(c0 TIMESTAMP);"));
REQUIRE_NO_FAIL(con.Query("INSERT INTO t0 VALUES(NULL);"));
REQUIRE_NO_FAIL(con.Query("DELETE FROM t0;"));
REQUIRE_NO_FAIL(con.Query("ALTER TABLE t0 ALTER c0 TYPE DATE;"));
REQUIRE_NO_FAIL(con.Query("INSERT INTO t0 VALUES(NULL);"));
REQUIRE_NO_FAIL(con.Query("UPDATE t0 SET c0 = '1969-12-18'; "));
}
SECTION("624") {
// ALTER TABLE results in an assertion failure "Assertion `expr.return_type == vector.type' failed"
REQUIRE_NO_FAIL(con.Query("CREATE TABLE t0(c0 INT, c1 VARCHAR);"));
REQUIRE_NO_FAIL(con.Query("INSERT INTO t0(c1) VALUES(NULL);"));
REQUIRE_NO_FAIL(con.Query("ALTER TABLE t0 ALTER c1 TYPE TIMESTAMP;"));
}
}

0 comments on commit b6a065d

Please sign in to comment.