Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

fix internal catalog tables cannot be updated with SQL. #1643

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/optimizer/plan_generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,7 @@ void PlanGenerator::Visit(const Update *op) {
}
}

std::unordered_set<std::string> update_column_names;
std::unordered_set<catalog::col_oid_t> update_column_oids;

// Evaluate update expression and add to target list
auto updates = op->GetUpdateClauses();
Expand All @@ -922,7 +922,7 @@ void PlanGenerator::Visit(const Update *op) {
auto upd_value = parser::ExpressionUtil::EvaluateExpression(children_expr_map_, update->GetUpdateValue()).release();
builder.AddSetClause(std::make_pair(col_id, common::ManagedPointer(upd_value)));

update_column_names.insert(update->GetColumnName());
update_column_oids.insert(col_id);
RegisterPointerCleanup<parser::AbstractExpression>(upd_value, true, true);
}

Expand All @@ -931,8 +931,8 @@ void PlanGenerator::Visit(const Update *op) {
// TODO(tanujnay112) can optimize if we stored updated column oids in the update nodes during binding
// such that we didn't have to store string sets
for (auto &cve : cves) {
if (update_column_names.find(cve.CastManagedPointerTo<parser::ColumnValueExpression>()->GetColumnName()) !=
update_column_names.end()) {
if (update_column_oids.find(cve.CastManagedPointerTo<parser::ColumnValueExpression>()->GetColumnOid()) !=
update_column_oids.end()) {
indexed_update = true;
break;
}
Expand Down