From 214603c232507cabd928e9cd5bfeedcbe7f14036 Mon Sep 17 00:00:00 2001 From: Li Yichao Date: Sat, 23 Apr 2022 17:28:37 +0800 Subject: [PATCH] fix internal catalog tables cannot be updated with SQL. * https://github.com/cmu-db/noisepage/issues/1448 --- src/optimizer/plan_generator.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/optimizer/plan_generator.cpp b/src/optimizer/plan_generator.cpp index 9ed33e63d6..ebc5249dec 100644 --- a/src/optimizer/plan_generator.cpp +++ b/src/optimizer/plan_generator.cpp @@ -906,7 +906,7 @@ void PlanGenerator::Visit(const Update *op) { } } - std::unordered_set update_column_names; + std::unordered_set update_column_oids; // Evaluate update expression and add to target list auto updates = op->GetUpdateClauses(); @@ -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(upd_value, true, true); } @@ -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()->GetColumnName()) != - update_column_names.end()) { + if (update_column_oids.find(cve.CastManagedPointerTo()->GetColumnOid()) != + update_column_oids.end()) { indexed_update = true; break; }