fix select * from subquery ambiguously error

This commit is contained in:
hy-guo
2023-09-28 03:10:01 +00:00
committed by ob-robot
parent 92e021b104
commit ed08722e44

View File

@ -278,8 +278,12 @@ 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<ObColumnRefRawExpr *>(tmp_select_item.expr_)->is_joined_dup_column()) ? 0 : 1;
unduplicable_count += ((tmp_select_item.expr_->is_column_ref_expr()
&& static_cast<ObColumnRefRawExpr *>(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.
*/
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.