diff --git a/src/observer/mysql/ob_query_driver.cpp b/src/observer/mysql/ob_query_driver.cpp index ff8784d452..77fd447be7 100644 --- a/src/observer/mysql/ob_query_driver.cpp +++ b/src/observer/mysql/ob_query_driver.cpp @@ -542,10 +542,24 @@ int ObQueryDriver::process_lob_locator_results(ObObj& value, value.set_has_lob_header(); // must has lob header } } else if (!loc.has_extern()) { - // currently all temp lobs have extern field in oracle mode - // or the lob locator header cannot compatable with clients for 4.0 - ret = OB_INVALID_ARGUMENT; - LOG_WARN("Lob: oracle lob locator v2 with out extern segment", K(value), K(GET_MIN_CLUSTER_VERSION())); + if (!loc.has_inrow_data()) { + // currently all temp lobs have extern field in oracle mode + // or the lob locator header cannot compatable with clients for 4.0 + ret = OB_INVALID_ARGUMENT; + LOG_WARN("Lob: oracle lob locator v2 with out extern segment", K(value), K(GET_MIN_CLUSTER_VERSION())); + } else if (!is_support_outrow_locator_v2) { + // convert to full extern temp lob locator + ObString inrow_data; + if (OB_FAIL(loc.get_inrow_data(inrow_data))) { + LOG_WARN("Lob: get inrow data failed", K(ret), K(loc)); + } else { + value.set_string(value.get_type(), inrow_data.ptr(), inrow_data.length()); + value.set_inrow(); + if (OB_FAIL(ObTextStringResult::ob_convert_obj_temporay_lob(value, *allocator))) { + LOG_WARN("fail to convert temp lob locator", K(ret), K(value)); + } + } + } } else { if (!is_support_outrow_locator_v2 && !loc.has_inrow_data()) { if (OB_FAIL(ObTextStringIter::append_outrow_lob_fulldata(value, session_info, *allocator))) { diff --git a/src/sql/engine/expr/ob_expr_output_pack.cpp b/src/sql/engine/expr/ob_expr_output_pack.cpp index 246c526c15..3faf813e46 100644 --- a/src/sql/engine/expr/ob_expr_output_pack.cpp +++ b/src/sql/engine/expr/ob_expr_output_pack.cpp @@ -509,10 +509,24 @@ int ObExprOutputPack::process_lob_locator_results(common::ObObj& value, value.set_lob_value(value.get_type(), res.ptr(), res.length()); value.set_has_lob_header(); // must has lob header } - } else if (!loc.has_extern()) { // if has header but without extern header - // mock loc v2 with extern ? currently all temp lobs have extern field in oracle mode - // should not come here - OB_ASSERT(0); + } else if (!loc.has_extern()) { // if has header but without extern header + if (!loc.has_inrow_data()) { + // mock loc v2 with extern ? currently all temp lobs have extern field in oracle mode + // should not come here + OB_ASSERT(0); + } else if (!is_support_outrow_locator_v2) { + // convert to full extern temp lob locator + ObString inrow_data; + if (OB_FAIL(loc.get_inrow_data(inrow_data))) { + LOG_WARN("Lob: get inrow data failed", K(ret), K(loc)); + } else { + value.set_string(value.get_type(), inrow_data.ptr(), inrow_data.length()); + value.set_inrow(); + if (OB_FAIL(ObTextStringResult::ob_convert_obj_temporay_lob(value, alloc))) { + LOG_WARN("fail to convert temp lob locator", K(ret), K(value)); + } + } + } } else if (!is_support_outrow_locator_v2 && !loc.has_inrow_data()) { if (OB_FAIL(ObTextStringIter::append_outrow_lob_fulldata(value, &my_session, alloc))) { LOG_WARN("Lob: convert lob to outrow failed", K(value), K(GET_MIN_CLUSTER_VERSION()));