[CP] [to #54116671] fix serval pl bugs

This commit is contained in:
obdev
2024-01-03 16:12:58 +00:00
committed by ob-robot
parent 5c4d416a56
commit fe6691dbdd
4 changed files with 12 additions and 5 deletions

View File

@ -327,7 +327,7 @@ int ObDbmsInfo::define_column(int64_t col_idx, ObObjType col_type,
{
int ret = OB_SUCCESS;
if (col_idx < 0 || col_idx >= fields_.count()) {
ret = OB_SIZE_OVERFLOW;
ret = OB_ERR_VARIABLE_NOT_IN_SELECT_LIST;
LOG_WARN("define column position is invalid", K(col_idx), K(fields_), K(col_type), K(ret));
} else if (!cast_supported(fields_.at(col_idx).type_.get_type(),
static_cast<common::ObCollationType>(fields_.at(col_idx).charsetnr_),

View File

@ -5585,10 +5585,15 @@ int ObSPIService::spi_set_collection(int64_t tenant_id,
CK (type->is_collection_type());
CK (OB_NOT_NULL(collection_type = static_cast<const ObCollectionType*>(type)));
OZ (collection_type->get_element_type().newx(*coll.get_allocator(), ns, ptr));
if (OB_SUCC(ret) && collection_type->get_element_type().is_collection_type()) {
if (OB_FAIL(ret)) {
} else if (collection_type->get_element_type().is_collection_type()) {
ObPLCollection *collection = NULL;
CK (OB_NOT_NULL(collection = reinterpret_cast<ObPLCollection*>(ptr)));
OX (collection->set_count(0));
} else if (collection_type->get_element_type().is_record_type()) {
ObPLRecord *record = NULL;
CK (OB_NOT_NULL(record = reinterpret_cast<ObPLRecord*>(ptr)));
OX (record->set_null());
}
OZ (collection_type->get_element_type().get_size(*ns, PL_TYPE_INIT_SIZE, init_size));
OX (row->set_extend(ptr, collection_type->get_element_type().get_type(), init_size));

View File

@ -1571,7 +1571,8 @@ int ObSql::handle_pl_execute(const ObString &sql,
#endif
if (OB_SUCC(ret) && session.get_in_transaction()) {
if (ObStmt::is_dml_write_stmt(result.get_stmt_type()) ||
ObStmt::is_savepoint_stmt(result.get_stmt_type())) {
ObStmt::is_savepoint_stmt(result.get_stmt_type()) ||
(ObStmt::is_select_stmt(result.get_stmt_type()) && OB_NOT_NULL(result.get_physical_plan()) && result.get_physical_plan()->has_for_update())) {
session.set_has_exec_inner_dml(true);
}
}

View File

@ -55,6 +55,8 @@ int ObCallProcedureResolver::resolve_cparams(const ParseNode *params_node,
ObIArray<ObRawExpr*> &params)
{
int ret = OB_SUCCESS;
bool has_assign_param = false;
CK (OB_NOT_NULL(routine_info));
CK (OB_NOT_NULL(call_proc_info));
@ -64,7 +66,6 @@ int ObCallProcedureResolver::resolve_cparams(const ParseNode *params_node,
}
// Step 2: 从ParamsNode中解析参数
if (OB_SUCC(ret) && OB_NOT_NULL(params_node)) {
bool has_assign_param = false;
if (T_SP_CPARAM_LIST != params_node->type_) {
ret = OB_INVALID_ARGUMENT;
LOG_WARN("invalid params list node", K(ret), K(params_node->type_));
@ -107,7 +108,7 @@ int ObCallProcedureResolver::resolve_cparams(const ParseNode *params_node,
}
if (OB_SUCC(ret)) { // 判断所有参数没有复杂表达式参数
bool v = true;
bool v = (false == has_assign_param);
for (int64_t i = 0; v && OB_SUCC(ret) && i < params.count(); i ++) {
if (OB_ISNULL(params.at(i))) {
ret = OB_INVALID_ARGUMENT;