Fixed the issue where the column could not be queried after the column default value was deleted

This commit is contained in:
hwx65 2024-03-13 08:27:29 +00:00 committed by ob-robot
parent a88b712c55
commit 3b2bc2118f
3 changed files with 14 additions and 2 deletions

View File

@ -11125,7 +11125,7 @@ int ObDMLResolver::add_sequence_id_to_stmt(uint64_t sequence_id, bool is_currval
exist = true;
}
}
if (!exist) {
if (!exist && sequence_id != OB_INVALID_ID) {
// 如果是 CURRVAL 表达式,则指示 stmt 生成 SEQUENCE 算子,但不做具体事情
//
// 如果是 NEXTVAL 表达式,则添加到 STMT 中,提示 SEQUENCE 算子为它计算 NEXTVALUE

View File

@ -1881,7 +1881,18 @@ int ObRawExprUtils::resolve_sequence_object(const ObQualifiedName &q_name,
syn_checker,
sequence_id,
&dblink_id))) {
LOG_WARN_IGNORE_COL_NOTFOUND(ret, "check basic column namespace failed", K(ret), K(q_name));
// Except for table creation, sequence_not_exist error can be ignored in the resolver phase
// for sequence in definition of default column. If an error needs to be reported such as when
// insert or update column with default value, check it again in the execution phase.
if (NULL != stmt && stmt::T_CREATE_TABLE != stmt->get_stmt_type() && is_generated_column
&& ret == OB_ERR_BAD_FIELD_ERROR) {
ret = OB_SUCCESS;
} else {
LOG_WARN_IGNORE_COL_NOTFOUND(ret, "check basic column namespace failed", K(ret), K(q_name));
}
}
if (OB_FAIL(ret)) {
// do nothing
} else if (OB_UNLIKELY(T_FIELD_LIST_SCOPE != current_scope &&
T_UPDATE_SCOPE != current_scope &&
T_INSERT_SCOPE != current_scope)) {

View File

@ -2353,6 +2353,7 @@ int ObSQLSessionInfo::get_sequence_value(uint64_t tenant_id,
int ret = OB_SUCCESS;
if (OB_UNLIKELY(OB_INVALID_ID == tenant_id ||
OB_INVALID_ID == seq_id)) {
ret = OB_ERR_SEQ_NOT_EXIST;
LOG_WARN("invalid args", K(tenant_id), K(seq_id), K(ret));
} else if (OB_FAIL(sequence_currval_map_.get_refactored(seq_id, value))) {
LOG_WARN("fail get seq", K(tenant_id), K(seq_id), K(ret));