Skip to content

Commit

Permalink
When no columns are bound in USING clause of ALTER TYPE, bind rowid i…
Browse files Browse the repository at this point in the history
…nstead (fixes #629)
  • Loading branch information
Mytherin committed May 5, 2020
1 parent 5624a82 commit ea6cd82
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/catalog/catalog_entry/table_catalog_entry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,9 @@ unique_ptr<CatalogEntry> TableCatalogEntry::ChangeColumnType(ClientContext &cont
auto expression = info.expression->Copy();
auto bound_expression = expr_binder.Bind(expression);
auto bound_create_info = binder.BindCreateTableInfo(move(create_info));
if (bound_columns.size() == 0) {
bound_columns.push_back(COLUMN_IDENTIFIER_ROW_ID);
}

auto new_storage =
make_shared<DataTable>(context, *storage, change_idx, info.target_type, move(bound_columns), *bound_expression);
Expand Down
6 changes: 5 additions & 1 deletion src/storage/data_table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,11 @@ 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[bound_columns[i]]);
if (bound_columns[i] == COLUMN_IDENTIFIER_ROW_ID) {
types.push_back(ROW_TYPE);
} else {
types.push_back(parent.types[bound_columns[i]]);
}
}

DataChunk scan_chunk;
Expand Down

0 comments on commit ea6cd82

Please sign in to comment.