diff --git a/src/sql/resolver/dml/ob_column_namespace_checker.cpp b/src/sql/resolver/dml/ob_column_namespace_checker.cpp index 6dabf76425..8730dce620 100644 --- a/src/sql/resolver/dml/ob_column_namespace_checker.cpp +++ b/src/sql/resolver/dml/ob_column_namespace_checker.cpp @@ -278,12 +278,8 @@ int ObColumnNamespaceChecker::check_column_exists(const TableItem &table_item, c for (int64_t i = 0; OB_SUCC(ret) && i < ref_stmt->get_select_item_size(); ++i) { SelectItem& tmp_select_item = ref_stmt->get_select_item(i); if (ObCharset::case_compat_mode_equal(col_name, tmp_select_item.alias_name_)) { - unduplicable_count += ((tmp_select_item.expr_->is_column_ref_expr() - && static_cast(tmp_select_item.expr_)->is_joined_dup_column()) - || !(tmp_select_item.expr_->is_aggr_expr())) ? 0 : 1; - /* Unduplicable_count is use for column duplicated report in oracle mode. - * It seems only aggr funcs in PIVOT shoulds cause this error. - */ + unduplicable_count += (tmp_select_item.expr_->is_column_ref_expr() + && !(static_cast(tmp_select_item.expr_)->is_joined_dup_column())) ? 1 : 0; if (!is_exist) { // set the is_exist = true, is there is a column with the same column name. // no matter the column is a duplicable column, we should set the exists to true.